欢迎来到天天文库
浏览记录
ID:20462866
大小:101.80 KB
页数:9页
时间:2018-10-12
《按键控制灯亮灭程序代码》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Zigbee模块之间的互相通讯:include"ZComDef.h"include"OSAL.h”includeHOSAL_Nv.hn#include"OnBoard.h"includeHZMAC.hH/*Hal*/#include"hal_lcd.hn#include”hal_led.hn#include"hal_adc.h”#include"hal_drivers.h”#include”hal_assert.h”includenhal_flash.h*7/初始化一些配置f、!,、!,、!,、!,、丄,、丄,、丄,a*MACROS//
2、宏指令*//、!,、!,、!,、!,、丄,、丄,、丄,/*CONSTANTS//常量//MaximunnumberofVddsamplescheckedbeforegoon#defineMAX_VDD_SAMPLES3#defineZMAIN_VDD_LIMITHAL_ADC_VDD_LIMIT_4//工作电压限制/、!,、!,、!,、!,、丄,、丄,、丄,a*TYPEDEFS//典型定义*//%1^、!,、!,、!,、!,、丄,、丄,、丄,/*GLOBALVARIABLES//全局变量*//%1^%1^%1^%1^%1^、!,、!,、
3、!,、!,、丄,、丄,、丄,/*EXTERNALVARIABLES//外部变量*//,1,%
4、^%
5、^%
6、^%
7、^%
8、^%
9、^%
10、^*1^^if^if!^T>^T>^T>^T>^T>^T>^T>^T>*EXTERNALFUNCTIONS//外部函数*/externboolHalAdcCheckVdd(uint8limit);//外部转换器丨.作电压检查*LOCALVARIABLES//局部变量*/f、!,、!,、!,、!,、丄,、丄,、丄,a*LOCALFUNCTIONS//局部函数staticvoidzmain_dev_info(vo
11、id);staticvoidzmain_ext_addr(void);staticvoidzmain_vdd_check(void);#ifdefLCD.SUPPORTEDstaticvoidzmainjcd一init(void)#endif/、!,、!,、!,、!,、丄,、丄,、丄,a*@fnmain*@brief*@returndon’tcare*/intmain(void){//关ffl中断osal_int_disable(INTS_ALL);//参数为INTS_ALL则关闭所冇中断,杏则关闭相应屮断//Initializatio
12、nforboardrelatedstuffsuchasLEDs//处理器运行时钟,LEDIO口设置HAL_BOARD_INIT();//初始化板子硬件部分//Makesuresupplyvoltageishighenoughtorun//确保Hi源Hi压足够商来运行zmain_vdd_check();//InitializeboardI/O//初始化I/OInitBoard(OB—COLD);//InitialzeHALdrivers//硬件驱动HalDriverInit();//InitializeNVSystem//nv系统初始化o
13、sal_nv_init(NULL);//InitializetheMAC//初始化计算机系统ZMacInit();//Determinetheextendedaddress//确定扩展地址zmain_ext_addr();//InitializebasicNVitems//初姑化虚拟条目zglnit();#ifndefNONWK//SincetheAFisn'tatask,callit'sinitializationroutine//初始化程序aflnit();#endif//Initializetheoperatingsystem//
14、初始化操作系统osal_init_system();//Allowinterrupts//允许巾断osal_int_enable(INTS_ALL);//Finalboardinitialization//最终的硬件初始化InitBoard(OB—READY);//Displayinformationaboutthisdevice//显•欠于这个设备的信息zmain_dev_info();/*DisplaythedeviceinfoontheLCD*//在液晶屏上姑示设备信、ifdefLCD_SUPPORTEDzmain_lcd_i
15、nit();#endif#ifdefWDT_IN_PMl//如果监视器被占用,这个位置可以启用WatchDogEnable(WDTIMX);#endifosal_start_system();//操作系统初
此文档下载收益归作者所有