
Originally Posted by
tss
so did you mean i have to change my program from
do{
..... } while (1);
to
while (1) {
..... };
No, it will work both ways. You can check the web for syntax.
Code:
do {
temp_res = ADC_Read(2) >> 2;
USART_Write(temp_res);
Delay_ms(100);
} while (1);
I am guessing you expect to see the result of the ADC_Read display on hyperterminal.
Code:
void Usart_Write(unsigned short data);
If the ADC conversion returns 65 you will see the letter 'A' in hyperterm. 66 will result in 'B'. Because 65 is the ascii value for A and 66 is the ascii value for B.
You can either use printf which has the ability to convert you number to a string (ie 65 becomes the char 6 followed by the char 5) or itoa (int to ascii) to get a string of characters and use Usart_Write to send each out in order.
Both of these are somewhat compiler dependant and there is no mention of which complier you are using.
I did not look at the schematic.