Hi all,
I have a problem with the below code.
char cmin[3]={'0','0','0'}; while(1) // do this forever { itoa(cmin,50,10); //50 is our test number, base 10 //cmin={0x35, 0x30, 0x00} i=0; while(cmin[i]!=0) // test to see if we have reached the null(last) char in the string { A=cmin[i]; // Replace A with UDR0 to use usart while(!(UCSR0A &(1<<UDRE0))) ; //wait until char is sent. i++; } }
The problem is this. If I have a number that ends in 0 (10,20,...) it will drop the 0 when sending over the Usart of the Mega48 but works fine in studio 4.11. However when the number does not end in 0 it will send it over the usart without any issues.
so if I send 49, 50, 51,.. I will get 49,5,51.....
I am using ImageCraft 6.31A as the comipler.
Any ideas what is wrong?
Thanks,
Caleb