Greetings,
I am looking for way to read the P1 Port in the 8051 and send to the serial port when the uC receives the "a" character. However I need to send a decimal string that corresponds to the state of the P1 Port. What is the correct way to do that?
I tried those methods below however I always receive a ASCII character istead of a decimal string.
To clarify even more... For example, consider that P1 register is at 7D and when I press the "a" character in the hyperterminal I need to see the number 125 on the screen and not the "}" symbol.
Thanks,
FBorges22
I am looking for way to read the P1 Port in the 8051 and send to the serial port when the uC receives the "a" character. However I need to send a decimal string that corresponds to the state of the P1 Port. What is the correct way to do that?
I tried those methods below however I always receive a ASCII character istead of a decimal string.
Rich (BB code):
void send_serial()
{
SBUF=P1;
while(!TI);
TI=0;
SBUF=0x0A; // sends the "\n" ascii character
while(!TI);
TI=0;
}
void receive_serial() interrupt 4 using 0
{
while(!RI);
RI=0;
sbuffer=SBUF;
if (sbuffer == 0x61)
{
send_serial();
}
}
Thanks,
FBorges22