bianchi77
Advanced Member level 4
- Joined
- Jun 11, 2009
- Messages
- 1,313
- Helped
- 21
- Reputation
- 44
- Reaction score
- 20
- Trophy points
- 1,318
- Location
- California
- Activity points
- 9,442
Friend,
I have a function below, how can I use the output of that function in the main() ?
can it be like this :
I tried to use putty but nothing happened yet ?
Thanks
I have a function below, how can I use the output of that function in the main() ?
Code:
unsigned char ReceiveSerial() {
unsigned char c;
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 253; /* TH1: reload value for 9600 baud @ 11.0592MHz +/- 3.5% error */
TR1 = 1; /* TR1: timer 1 run */
TI = 1; /* TI: set TI to send first char of UART */
while( (SCON & 0x01) == 0 ) /* wait for receive data */;
[B] c = SBUF;
return c;[/B]
}
// would it be like this :
main()
{
ReceiveSerial(); // how can I use the output of this function ?
[B]if (c="A")
{
display_spectrum();
}[/B]
}
can it be like this :
Code:
if (ReceiveSerial()="A")
// Do something
I tried to use putty but nothing happened yet ?
Thanks
Last edited: