The United States “dollar” was the adoption of the German monetary unit “thaler” that had become synonymous with the silver coin of about 28 g. Therefore the dollar was actually based upon the Spanish silver 8 Reales coins commonly called dollars which had become the mainstay of the colonial monetary system.
The term “Piece of Eight” refers to the fact that these coins were often cut into “pieces” to make small change. These pieces were called a “bit” representing 12.5 cents and thus 8 bits was equal to 8 shillings which equaled a pound. By the time the US dollar was created in 1794, "two bits" was equal to 25 cents (quarter dollar).

Detailed history of the dollar