So, your Filt is a 32 bit number in 20.12 format? Odd that you didn't=20 mention that before. Is there any chance of you providing a snippet of=20 code that implements your version of the filter? Kerry Olin Lathrop wrote: > Kerry Wentworth wrote: > =20 >> Do you have a math library of some sort to do 10.6 arithmetic? >> =20 > > Not specifically. I do have various 32 bit math routines for PICs. > > The advantage of fixed point is that for much of the processing you can > treat the numbers as integers. The machine just does the add, only you k= now > that you consider the least significant 6 bits to be fraction bits. > > =20 >> For example, a 1/2 scale left justified A/D reading would be >> >> 1000 0000 00.00 0000 >> and 1/16 would be >> 0000 0000 00.00 0100 >> =20 > > Yes. > > =20 >> The desired result is 0000 1000 00.00 0000 >> =20 > > Assuming you want to multiply the two numbers, which you didn't say. > > =20 >> Doing a binary multiply would result in a value of 0. >> =20 > > No. I don't see how you get that no matter how you think multiply works. > > If you just multiply fixed point numbers together as if they were integer= s, > then the result has the total number of fraction bits in both the input > numbers, which in this example is 12. The result of a straight integer > multiply without any prescaling would be: > > 1000000000.000000 > x 0000000000.000100 > ------------------- > 00000000100000000000.000000000000 > > Again, the fact that you consider these numbers to have a binary point > somewhere in the middle is totally on your end. The processor just does > integer arithmetic. > > =20 >> On the other hand, a 1/2 scale right justified A/D reading would be >> 0000 0010 00.00 0000 >> =20 > > That doesn't make sense. If you are using right justified A/D readings, > then they would be integers. I don't see where the fraction bits are > supposed to come from in this case. > > =20 >> Please pardon my ignorance, I'm here to learn. Is 10.6 arithmetic >> something that everybody but me uses? Is it an assembly language >> thing? >> =20 > > Fixed point in general is commonly used on small systems like PICs. 10.6 > format is just one example, which has 6 fraction bits in a 16 bit number. > Fixed point is common when you need to represent fractional values but ha= ve > a integer arithmetic processor. It's more tricky than floating point > because you have to keep track of where the imagined binary point is. > > One way to think of floating point is that it stores the binary point > information in the number, and updates everything accordingly at run time= .. > That takes more hardware, which small processors like PICs don't have. > > =20 >> I use a C compiler almost exclusively. >> =20 > > There's the problem. Wake up and smell the bits. It is difficult to > understand what is really going on if you keep a compiler between you and > what is really going on. > > > ******************************************************************** > Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products > (978) 742-9014. Gold level PIC consultants since 2000. > =20 --=20 Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .