麻烦各位高手帮我看看,为什么我将红外控制和无线通信整到一块去之后,无线通信就不好用了?
#include <stm32f10x_lib.h>
#include "sys.h"
#include "usart.h"
#include "delay.h"
#include "led.h"
#include "key.h"
#include "exti.h"
#include "wdg.h"
#include "timer.h"
#include "lcd.h"
#include "rtc.h"
#include "wkup.h"
#include "adc.h"
#include "dma.h"
#include "24cxx.h"
#include "flash.h"
#include "touch.h"
#include "24l01.h"
#include "mmc_sd.h"
#include "remote.h"
u8 buf,tmp_buf[2];
u8 wuxian()
{
// LCD_ShowString(60,150,"NRF24L01 TX_Mode");
while(1)
{ while(NRF24L01_Check())//检测不到24L01
{
LCD_ShowString(60,130,"24L01 Check Failed!");
delay_ms(500);
LCD_ShowString(60,130,"Please Check! ");
delay_ms(500);
LED0=!LED0;//DS0闪烁
}
LCD_ShowString(60,130,"24L01 Ready!");
TX_Mode();
// mode=' ';//从空格键开始
while(1)
{
if(NRF24L01_TxPacket(tmp_buf)==TX_OK)
{
tmp_buf[0]=buf;
tmp_buf[1]=0;//加入结束符
}
else
{
LCD_ShowString(60,170,"Send Failed ");
LCD_Fill(0,188,240,218,WHITE);//清空上面的显示
};
LED0=!LED0;
delay_ms(1500);
}
}
}
int main(void)
{
u8 key;
u8 t;
Stm32_Clock_Init(9);//系统时钟设置
delay_init(72); //延时初始化
uart_init(72,9600); //串口1初始化
LCD_Init(); //初始化液晶
LED_Init(); //LED初始化
Remote_Init(); //初始化红外接收
NRF24L01_Init(); //初始化NRF24L01
  OINT_COLOR=RED;//设置字体为红色
while(1)
{
if(Remote_Rdy)
{
key=Remote_Process();
switch(key)
{
case 104: //
LCD_ShowString(86,150, "1");
buf='1'; // wuxian();//buf[1]=0;//printf("%d",buf[0]);printf("1输出\n");
break;
case 152:
LCD_ShowString(86,150, "2");
buf='2'; // wuxian();//buf[1]=0;//printf("%d",buf[0]); printf("2输出\n");
break; //
case 176:
LCD_ShowString(86,150, "3");
buf='3'; // wuxian();//buf[1]=0;//printf("%d",buf[0]); printf("3输出\n");
break;
case 48:
LCD_ShowString(86,150, "4");
buf='4'; // wuxian();//buf[1]=0;//printf("%d",buf[0]);printf("4输出\n");
break;
case 24:
LCD_ShowString(86,150, "5");
buf='5'; // wuxian();//buf[1]=0;//printf("%d",buf[0]); printf("5输出\n");
break;
case 122:
LCD_ShowString(86,150, "6");
buf='6'; // wuxian();//buf[1]=0;//printf("%d",buf[0]); printf("6输出\n");
break;
case 16:
LCD_ShowString(86,150, "7");
buf='7'; // wuxian();//buf[1]=0;//printf("%d",buf[0]); printf("7输出\n");
break;
case 56:
LCD_ShowString(86,150, "8");
buf='8'; // wuxian();//buf[0]=8;//printf("%d",buf[0]);printf("8输出\n");
break;
}
//printf("%d",buf);
wuxian();
Remote_Rdy=0;
}
else
delay_ms(2);
t++;
if(t==200)
{
t=0;
LED1=!LED1;
}
}
}
|