STM8红外程序
单片机源程序如下:
- /********************************************\
- _ooOoo_
- o8888888o
- 88" . "88
- (| -_- |)
- O\ = /O
- ____/`---'\____
- .' \\| |// `.
- / \\||| : |||// \
- / _||||| -:- |||||- \
- | | \\\ - /// | |
- | \_| ''\---/'' | |
- \ .-\__ `-` ___/-. /
- ___`. .' /--.--\ `. . __
- ."" '< `.___\_<|>_/___.' >'"".
- | | : `- \`.;`\ _ /`;.`/ - ` : | |
- \ \ `-. \_ __\ /__ _/ .-` / /
- ======`-.____`-.___\_____/___.-`____.-'======
- `=---='
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 佛祖保佑 永无BUG
-
- 楠A407舍长出品
-
- \********************************************/
- #include "stm8s.h"
- #include "stm8s003f3p.h"
- #include "STM8_IR.h"
- #define uchar unsigned char
- #define uint unsigned int
- _Bool Flag_ir = 0;
- void STM8_CLK_Init(void)
- {
-
- CLK_HSICmd(ENABLE);//HSI = 16MHz
-
- CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); //f_psc = 16MHz/1
-
-
- }
- //--------------------主函数分割线---------------------
- //
- //
- //-----------------------------------------------------
- void main(void)
- {
- unsigned char re ;
- unsigned char reg;
-
- _asm("sim");//关全部中断
-
- STM8_CLK_Init();//内部HSI,16MHz
-
- LED_Init();
- IR_Init();
-
- TIM1_Init();
-
- _asm("rim");//开全部中断
-
- while(1)
- {
-
- //IR_test();
-
-
- }
- }
复制代码
所有资料51hei提供下载:
STM8_IR_test.rar
(4.02 MB, 下载次数: 79)
|