Last edited by Acetronics2; - 26th August 2010 at 13:28.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Hi Alain,
Bear with me, I am a beginner
I have read the DIV32 entry from the manual, that's how I learned about DIV32 in the first place. It says it can divide a 31bit number by a 15bit number, that means I could make the numerator very large, but he problem is that since the value of Vout (the denominator) can be as low as 1, then the result would not fit into a WORD variable. Therefore the maximum value for the numerator has to be 65535, which is what I got in my example. (well 65535 is technically 1024*64, but you get the point)
Vin = 1023 * 64
temp = Div32 Vout
Maybe you mean something I am not seeing, if so please let me know, I am new to this stuff.
Also I am not sure what you mean about my measuring method? All I want is to compute the unknown resistance from a voltage divider. But that should be irrelevant, shouldn't it? I mean, the problem here is just an integer arithmetic one.
I appreciate your help guys.
Last edited by dream-; - 26th August 2010 at 17:34.
Alain,
I think I understand what you mean with the comment about the measurement range. Maybe I could just make two cases or simply make Vout have a range from say 3 to 1023. That way I could really scale up the numerator and still have a result within the bounds of a WORD.
Here's one of the best sites I know of for tips & tricks working with integer math on small systems: http://www.emesystems.com/BS2index.htm
Thank you Bruce, that page has a wealth of information!
There is even a section on my particular problem of division where the denominator is a variable.
Let's see how they do it...
Bookmarks