hi all,
i'm facing problem in getting incorrect data from my usart.
my pc is sending one hex value and one dec value when i press a button. To check is it the correct data has been received, i output the value to my atmega32L PORTB.
eg: PC sending 0x32 and 90(dec).
when i check on the PORTB the value display out for 0x32 is correct but for 90(dec) which is 0101 1010(binary)i get this------> 0010 1101 .
sent: ->0101 1010
received:->0010 1101
--------->00101 101
It seems like shifted to the left once. i try to send other decimal value to confirm this situation i get the same result.it seems like shifted.
Below is my coding.
for(int i=0; i<2; i++) { while ((UCSRA & (1 << RXC)) == 0) {}; data[i]=UDR; first_data = data[0]; second_data = data[1]; PORTB = second_data; _delay_ms(1000); }
thank you.