>What is the point in ADC if you can't use floating point? The 16F88 >has ADC but even Microchip's C compiler will not work for it. I don't >see how ADC can be usful without a multiply and divide instrution to >calcuate the actual voltage value from the 10 bit representation. You don't need FP to do multiply and divide.... Looks like you don't really understand when to use floating point... FP gives you RANGE, not Precision. For a given size of variable, fixed-point will always be more accurate, faster and use less code than FP. Embedded systems rarely encounter real-world values that need the range that FP offers. Unless you are getting into complex maths, Fixed-point/integer values of suitable widths are almost always much more efficient in a resource-limited environment like a PIC. e.g. to display an ADC value from 0..1023 as a voltage from 0..9.999V, multiply it up to give a value from 0 to 9999 and just insert a DP in the appropriate place when you display the result. The factor needed above is 9.774, so you need to represent this as a fixed-point binary value. e.g. multiply it by 2^12 to give a constant value of 40034 (2^12 chosen so it fits in 16 bits) You then do a 16x16=>32 bit multiply of the ADC result by this constant, and shift the result right by 12 bits to get the result in millivolts. A slightly more efficient way might be to shift the ADC result up so the number of shifts of the original value plus the shifts of the constant is a multiple of 8, then you just use the appropriate bytes of the result. You can add a small 'fudge factor' to the constant to correct for rounding errors caused by truncating the result. The other thing you can do is to use the constant as a cailbration factor to fine-adjust the scaling. The only thing you need to take care over is where to put the fixed point so you don't overflow - in some cases the ideal fixed-point position may vary in different parts of the code, but as long as you keep track of things this is not a problem. These techniques are equally applicable to assembler and C. Although C has the advantage that it's easier to deal with larger numbers, but can be less efficient as you need to go to a 4-byte long if you need more than 16 bits, whearas in assembler you can do a 'medium' data type of 3 bytes. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist