前不久,要用单片机做一个发送红外遥控码的程序,以前只搞硬件,第一次作软件,不知所以然,想到网上参考一下,结果找来找去总是那么一个,还是用汇编写的,看了很久不知讲些什么,只好自己写了。在此给像我一样的新手一个参考,分享一下。
这个程序主要是用单片机来控制数码相框(或广告机),利用人体红外探头检测是否有人移动,然后根据用记所选择的模式来控制数码相框(或广告机)的工作状态。
代码如下:
以下是头文件:
- //
- //
- // this header file is programmed by hdl ,
- // maybe there are something that is not correct ,
- // please connect me when come accross problem ,
- // e_mail:de_12@163.com
- //
- //
- // the following is header file
- //
- // if you use any other [single chip computer] or [PIC] ,
- // please change this header file only , you don not hava to
- // change the [C] file
- //
- // programmed on 2008 - 08 - 29
- //
- // single chip computer [holtek ht48f06e] , web site : http://www.holtek.com.tw ; http://www.holtek.com.cn
- //
- //
- #ifndef haodl_h_file
- #define haodl_h_file
- #ifndef hdl_inlcude_ht48f06e
- #include "ht48f06e.h"
- #define hdl_inlcude_ht48f06e
- #define single_chip_is_ht48f06e 1
- #define __mod_can_change_by_key__
- #endif
- #ifdef __mod_can_change_by_key__
- #define keychange 0
- #define plugchange 1