求正点原子红外遥控定时程序开始,暂停怎么做.我的板是288元套件.第一次接触32位机,需要很多帮助.
#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"
//Mini STM32开发板范例代码21
//红外遥控 实验
//正点原子@ALIENTEK
//2010.6.17
int main(void)
{
u8 key;
u8 t;
u8 pm;
u8 ps;
pm=20;
ps=59;
Stm32_Clock_Init(9);//系统时钟设置
delay_init(72); //延时初始化
uart_init(72,9600); //串口1初始化
LCD_Init(); //初始化液晶
LED_Init(); //LED初始化
Remote_Init(); //初始化红外接收
 OINT_COLOR=RED;//设置字体为红色
LCD_ShowString(60,50,"Mini STM32");
LCD_ShowString(60,70,"REMOTE TEST");
LCD_ShowString(60,90,"ATOM@ALIENTEK");
LCD_ShowString(60,110,"2010/6/17");
LCD_ShowString(30,130, "KEYVAL:");
LCD_ShowString(130,130,"KEYCNT:");
LCD_ShowString(30,150, "SYMBOL:");
while(1)
{
if(Remote_Rdy)
{
key=Remote_Process();
LCD_ShowNum(86,130,key,3,16);//显示键值
LCD_ShowNum(186,130,Remote_Cnt,3,16);//显示按键次数
switch(key)
{
case 0:
LCD_ShowString(86,150, "ERROR");
break;
case 162:
LCD_ShowString(86,150, "POWER ");
break;
case 98:
LCD_ShowString(86,150, "TH+ ");
pm=pm+5;
if(pm>=60)
{
pm=60;
}
break;
case 2:
LCD_ShowString(86,150, "RUN ");
break;
case 226:
LCD_ShowString(86,150, "HP ");
break;
case 194:
LCD_ShowString(86,150, "CH+ ");
pm=pm+1;
if(pm>=60)
{
pm=60;
}
break;
case 34:
LCD_ShowString(86,150, "CH- ");
if(pm<=0)
{
pm=1;
}
pm=pm-1;
break;
case 56:
LCD_ShowString(86,150, "8 ");
break;
case 224:
LCD_ShowString(86,150, "VOL- ");
break;
case 168:
LCD_ShowString(86,150, "TH- ");
if(pm<=5)
{
pm=5;
}
pm=pm-5;
break;
case 144:
LCD_ShowString(86,150, "VOL+ ");
break;
case 104:
LCD_ShowString(86,150, "1 ");
break;
case 152:
LCD_ShowString(86,150, "2 ");
break;
case 176:
LCD_ShowString(86,150, "3 ");
break;
case 48:
LCD_ShowString(86,150, "4 ");
break;
case 24:
LCD_ShowString(86,150, "5 ");
break;
case 122:
LCD_ShowString(86,150, "6 ");
break;
case 16:
LCD_ShowString(86,150, "7 ");
break;
case 90:
LCD_ShowString(86,150, "9 ");
break;
case 66:
LCD_ShowString(86,150, "0 ");
break;
case 82:
LCD_ShowString(86,150, "TSHIFT");
break;
}
}else delay_ms(2);
t++;
if(t==200)
{
t=0;
delay_ms(1000);
ps=ps-1;
if(ps==0)
{
if(pm==0)
{
pm=1;
}
pm=pm-1;
ps=59;
}
LCD_ShowNum(30,180,pm,15,16);
LCD_ShowNum(30,200,ps,15,16);
LED0=!LED0;
}
}
}
|