单片机蓝牙无线自动下载的解决办法
时间:10-02
整理:3721RD
点击:
- <font color="#000"><font face="微软雅黑">#include<reg51.h>
- sfr ISP_CONTR=0xe7;
- void UartInit(void) //<font style="background-color:inherit"><a href="mailto:9600bps@11.0592MHz" target="_blank">9600bps@11.0592MHz</a></font>
- {
- SCON = 0x50;
- PCON=0;
- TMOD=0x20; </font></font>
- <font color="#000"><font face="微软雅黑"><font style="background-color:inherit"> TL1 = 0xFD;</font></font></font>
- <font color="#000"><font face="微软雅黑"> TH1 = 0xFD;
- TR1 = 1;
- EA=1;
- ES=1;
- }
- void DelayMS(unsigned int x)
- {
- unsigned char d;
- while(x--)for(d=0;d<123;d++);
- }
- void com_service() interrupt 4 using 0
- {
- unsigned char buf;
- RI=0;
- buf=SBUF;
- if(buf==0xab)
- {
- DelayMS(2000);
- ISP_CONTR=0x60;</font></font>
- <font color="#000"><font face="微软雅黑"> }</font></font>
- <font color="#000"><font face="微软雅黑">}
- void main()
- {
- unsigned char v;
- UartInit();
- while(1)
- {
- {
- while(RI==0);
- v=SBUF;
- RI=0;
- P1=v;
- SBUF=v;
- while(TI==0);
- TI=0;
- }
- }</font></font>