Hi, me and a partner are doing a simple project of reading a value off a TMP35G, sending it to msp430g2553 adc10, taking that adc10memory value, and the problem starts here at the conversion and pushing it out to the double 7-seg.
The Physical hookup of the circuit is fine. P2OUT account for both bcd encoders to the double 7_segment displays.
The code works up to us doing the math.
With the ADC10 a value is read from the tmp35g from 0-1023 (0V-3.6V) and thrown in the adc10memory. We take that memory out and throw it into a register to do math to, R14.... and here is where we fail.
The msp430g2553 does not have a hardware multiplier but we must use it because of the class. So the equation to convert it is taking the read value....
'Value' / 1024(steps) x 3.6V (reference value). The new value in Volts is divided by .1mV per degree celsius, otherwise flipping it around the newV x 10 = XX degrees celsius.
Our problem is that the g2553 has only 16bits else known as XXXXh, and when we divide it with the above equation the, say calculated value of 1.8V to 18 degrees celsius loses the 8 when all is said and done.
To make up for some shortfalls of the g2553 we put the multiplication of 3.6 and 10 together to make the initial value to be divided bigger, but 1024 still brings it down to 000X.Yh, and the Y is lost because the MC doesn't have a spot for the Y.
We read horner's method in the TI forums, and it helped.... but it didn't help us figure out how to hold onto that ones digit value.
Any help to explain horner's method, show us how to hold onto the 1s digit value, cleverer math, would be nice.
PS i tried taking the value and then taking the 10s digit value by itself and saving it to a register, and then 1s digit value and saving it to a register, but if the 1s digit goes above 9 it turns into the alphabet so that same method of shifting left until the 1s digit is left, and then shifting it down back to the 1s digit place, and then taking that register, and after shifting the tens digit into its second hex value i would add the 1s digit to that 10s register to get say 1A which I'd send out to p2out. Celsius doesn't go into the alphabet.... -_-
We were using horner's method if rla-ing and rra-ing and add-ing and sub-ing and we got better, but are still failing in it!
Help wanted.