求助单片机蓝牙触控灯的程序问题,#include <reg52.h>
#include <stdio.h>
#include “lcd1602.h”
//ADC0809
sbit CLK=P3^4;
sbit ST=P3^5;
sbit EOC=P3^6;
sbit OE=P3^7;
sbit RELAY = P3^3;
unsigned int pass = 0;
unsigned int ADCshow;
unsigned char pressure = 50;
unsigned char mode=0;
unsigned char status = 0;
void delay(unsigned int s)
{
while(s–);
}
void DelayMS(unsigned int ms)
{
unsigned char i;
while(ms–)
{
for(i=0;i<120;i++);
}
}
void Timer0_INT() interrupt 1
{
TH0=(65536-200)/256;
TL0=(65536-200)%256;
CLK=~CLK;
}
void UART_init() //设置串行通信 本晶振为11.0592MHZ,其他的就自己算一下应该设置多少
{
TMOD = 0x20;
TH1 = 0xfd;
TL1 = 0xfd; //波特率9600
SM0 = 0;
SM1 = 1; // 串口工作方式1 10位异步
REN = 1; //串口允许接收
TR1 = 1;
EA = 1;
ES =1 ; //串口中断
}
void main(void)
{
RELAY=1; //关灯
UART_init();
lcd_init(); //初始化1602
TMOD=0x01; //设置定时器0
TH0=(65536-200)/256; //初值重装
TL0=(65536-200)%256;
EA=1; //开总中断
ET0=1; //开定时器中断
TR0=1; //开定时器0
while(1)
{
//adc0809读取数据
ST=0;
OE=0;
ST=1;
ST=0;
while(EOC==0);
OE=1;
ADCshow=P1;
OE=0;
//lcd1602显示压力传感器值
LCD_ShowStr(0,0,”Real:”);
LCD_ShowChar(5,0,ADCshow/100+’0′);
LCD_ShowChar(6,0,ADCshow%100/10 +’0′);
LCD_ShowChar(7,0,ADCshow%10 +’0′);
if(ADCshow<pressure||pass==0x11)
{
RELAY=0; //亮灯
}
else
{ //否则
RELAY=1; //灭灯
}
}
}
void UART_INTERRUPT() interrupt 4
{
pass = SBUF;
RI = 0;
SBUF = pass; )
while(!TI);
TI = 0;
}
,我接了一个灯用蓝牙试了一下,蓝牙并不能控制,是不是程序哪里出了问题?