欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
51單片機利用藍牙傳輸數據代碼
[打印本頁]
作者:
GQL
時間:
2019-7-26 16:49
標題:
51單片機利用藍牙傳輸數據代碼
這是我在設計上設計的51單片機(stc98c52)與藍牙模塊(hc-08)連接,利用藍牙透傳模式做的相互通訊系統。
單片機源程序如下:
#include <reg51.h>
#define uint unsigned int
#define uchar unsigned char
void UsartInit();
void Delay1ms(uint c) ;
uchar receiveData;
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,
0xf8,0x80,0x90};
void main()
{
UsartInit();
while(1);
}
void UsartInit()
{
SCON=0X50;
TMOD=0X20;
PCON=0X80;
TH1=0XFA;
TL1=0XFA;
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=SBUF;
RI = 0;
SBUF=receiveData;
while(!TI);
TI=0;
if(receiveData=='0')
P0=table[0];
else if(receiveData=='1')
P0=table[1];
else if(receiveData=='2')
P0=table[2];
else if(receiveData=='3')
P0=table[3];
else if(receiveData=='4')
P0=table[4];
else if(receiveData=='5')
P0=table[5];
else if(receiveData=='6')
P0=table[6];
else if(receiveData=='7')
P0=table[7];
else if(receiveData=='8')
P0=table[8];
else if(receiveData=='9')
P0=table[9];
else
P0=~table[8];
Delay1ms(1000);
}
復制代碼
所有資料51hei提供下載:
STC89C52與藍牙模塊HC-08互通信.zip
(38.9 KB, 下載次數: 59)
2019-7-26 16:48 上傳
點擊文件名下載附件
例程
下載積分: 黑幣 -5
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1