problem with serial numbers
2012-07-19 by alex_p_silva
I'm a serial communication working perfectly, send and receive characters just fine, but when I get the characters (and I'm actually getting reinviando) believe that I am not knowing to use these functions in avr-gcc with CodeBlocks because I am beginner in avr and also beginner in C.
I send the pc VC00045, if I ask him to respond with the same string will put all right if I break it in and repay digit number in the form of mess everything appears 5353.
I tried to use the atoll, however atoi not succeed due to not being an unsigned char and not a constant.
the tests I ran the problem is here
temp1 = (CR3-'0 ') * 10000;
temp2 = (cr4-'0 ') * 1000;
temp3 = (CR5-0 ") * 100;
temp4 = (CR6-0 ") * 10;
temp5 = (CR7, '0 ');
value = temp1 + temp2 + temp3 +temp4 + temp5;
ltoa (value, string, 10);
USART_putstring (string) ;/ / send string over serial
thanks for the tips.