I'm developing a hobby project involving a 16F886 and a DDS, and for this I need to divide a 64-bit number by a 32-bit number to get a 32-bit result. The problem is that I seem to be too mathematically challenged to come up with a way to do this!
The division I need is unsigned.
The 64 bit number is actually a 32 bit number shifted left, so that the right 32 bits are always zero.
The actual numbers I will have for the dividend are in the range from 500,000 to 35,000,000 for the 32 MSBs (26 truly valid bits. The 6 MSBs stay at zero). That would be about 2*10^15 to 1.5*10^17 for the full 64 bit dividend, making it actually a 58 bit number.
The divisor will be between 150,000,000 and 500,000,000, so this is actually a 29 bit number.
The result I need to get will range from zero to about 1.5*10^9, so it's actually a 31 bit number.
How can I do this, using the 16 bit divide function of PBP?
Bookmarks