Home > other >  Using 89 c52 HC05 receive cell phone message, not receive buffer is 00 hair
Using 89 c52 HC05 receive cell phone message, not receive buffer is 00 hair

Time:12-03

#include
# define uint unsigned int
# define uchar unsigned char
Void UsartInit ();
Void Delay1ms (uint c);
Uchar receiveData;
Uchar code table []={xa4 xc0 0, 0 xf9, 0, 0 xb0, 0 x99, 0 x92, 0 x82,
0 xf8, 0 x80, 0 x90};
Void main ()
{
UsartInit ();
While (1);
}

Void UsartInit ()
{
SCON=0 x50;
TMOD=0 x20;
PCON=0 x80;
TH1=0 xfa;
TL1=0 xfa;
ES=1;
EA=1;
TR1=1;
}

Void Delay1ms (uint c)
{
Uint a, b;
For (a=c; A> 0; A -)
For (b=112; B> 0; B -);
}
Void Usart interrupt ()
4{
receiveData=https://bbs.csdn.net/topics/SBUF;
RI=0;
SBUF=receiveData;
while(! TI);
TI=0;
If (receiveDatahttps://bbs.csdn.net/topics/=='0')
P0=table [0];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='1')
P0=table [1];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='2')
P0=table [2];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='3')
P0=table [3].
Else if (receiveDatahttps://bbs.csdn.net/topics/=='4')
P0=table [4];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='5')
P0=table [5];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='6')
P0=table [6].
Else if (receiveDatahttps://bbs.csdn.net/topics/=='7')
P0=table [7];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='8')
P0=table [8];
Else if (receiveDatahttps://bbs.csdn.net/topics/=='9')
P0=table [9];
The else
P0=~ table [8];
Delay1ms (1000);
}

But even the TTL directly, bluetooth assistant receive character message no problem

CodePudding user response:

Void Usart interrupt () while (4! TI); Don't Delay1ms (1000);
  • Related