dheeruparu
Newbie level 4
Hi,Iam a newbie to PICs.
My project uses PIC16F877A to monitor temperature and transmit it serially as wellas display it on LCD.
I have a problem while passing the value to TXREG register for serial transmission.
The value of temperature varies and is an integer value.While displaying the value on LCD,Proteus simulator displays the value perfectly!
But the TX pin data is scrambled as i just pass the value given to LCD directly to TXREG register.
I want to know if there is a way to convert this integer value to binary before passing it to TXREG register.
The code snippet is as follows:
TXSTA = 0b00100010;
RCSTA = 0b10010000;
SPBRG=25;
while(!TRMT);
TXREG=tr;
tr has the calculated decimal value as integer.
this is where my doubt arises.Is the output wrong because Iam passing the decimal value directly to TXREG or is it due to any error in program elsewhere?
Please help me as early as possible... :-(
My project uses PIC16F877A to monitor temperature and transmit it serially as wellas display it on LCD.
I have a problem while passing the value to TXREG register for serial transmission.
The value of temperature varies and is an integer value.While displaying the value on LCD,Proteus simulator displays the value perfectly!
But the TX pin data is scrambled as i just pass the value given to LCD directly to TXREG register.
I want to know if there is a way to convert this integer value to binary before passing it to TXREG register.
The code snippet is as follows:
TXSTA = 0b00100010;
RCSTA = 0b10010000;
SPBRG=25;
while(!TRMT);
TXREG=tr;
tr has the calculated decimal value as integer.
this is where my doubt arises.Is the output wrong because Iam passing the decimal value directly to TXREG or is it due to any error in program elsewhere?
Please help me as early as possible... :-(