基于飞思卡尔DZ60的AD 1302 KEY 485 CAN FLASH LCD程序
#define DI1 PTGD_PTGD2 //外触发1----->
#define DI2 PTED_PTED5 //外触发2----->
#define DI3 PTED_PTED4 //外触发3----->
#define DI4 PTED_PTED3 //外触发4----->
#define JDQ1 PTCD_PTCD4 //继电器1----->
#define JDQ2 PTAD_PTAD5 //继电器2----->
#define JDQ3 PTBD_PTBD5 //继电器3----->
#define JDQ4 PTAD_PTAD6 //继电器4----->
#define JDQ5 PTBD_PTBD6 //继电器5----->
#define DE485 PTED_PTED2 //485 T R切换----->
if ( value_buf[i]>
seconds=((ReadValue&0x70)>>
minutes=((ReadValue&0x70)>>
hours=((ReadValue&0x70)>>
day=((ReadValue&0x70)>>
month=((ReadValue&0x70)>>
year=((ReadValue&0x70)>>
nian=((temp&0x70)>>
if(nian>
yue=((temp&0x70)>>
if(yue>
ri=((temp&0x70)>>
if(ri>
zhou=((temp&0x70)>>
if(zhou>
shi=((temp&0x70)>>
if(shi>
fen=((temp&0x70)>>
部时钟
MCGC2=0x40; //时钟源二分频
MCGTRM=0xa8;//内部时钟微调
}
//===================================
//函数名: IO_INIT
//作用: 初始化IO 输入输出
//====================================
void IO_INIT(void)
{
PTADD = 0xe6; //数据方向 1为输出,0为输入
PTBDD = 0x76;
PTCDD = 0xb0;
//PTDDD = 0xff;
PTEDD = 0x45;
PTFDD = 0xff;
PTGDD = 0x38;
PTAD = 0 ; //初始状态IO全为0
PTBD = 0;
PTCD = 0;
PTDD = 0;
PTED = 0;
PTFD = 0;
PTGD = 0;
}
//===================================
//函数名: ADC_INIT
//作用: 初始化ADC 总线时钟8M
//===================================
void ADC_INIT(void)
{
ADCCFG = 0xf9; //低功耗模式,10位精度,ADCK=总线频率/8/2=500K
ADCSC2 = 0x00; //0x00:软件触发,比较功能禁止
APCTL1 = 0x14; //通道引脚使能: 使用通道为AD19 AD11 AD3 AD4
APCTL2 = 0x08;
APCTL3 = 0x08;
ADch_s = 19; //选择19通道开始
ADCSC1 = 0x73; //0x53:中断使能,单次转换,选择19通道启动转换.
}
//===================================
//函数名:SCI_INIT
//作用: 初始化SCI1
//====================================
void SCI_INIT(void)
{
SCI1BD = 8000000/16/Baud;
SCI1C1 = 0x00;
SCI1C2 = 0x2c; //使能接受中断
}
//===================================
//串口发送
//===================================
void SCI1send (byte x)
{
while(SCI1S1_TDRE==0);
SCI1D = x;
}
//===================================
//定时器1初始化
//===================================
void TPM1_Init(void) //定时器1初始化
{
TPM1MODH=0x3d; //
TPM1MODL=0x09; //250MS
TPM1SC=0x4F; //TPM1时钟源为总线时钟;分频系数为128;溢出中断使能
}
//===================================
//延时
//===================================
void Delay(Word time)
{
Word i,j;
for(i=0;i
飞思卡尔DZ60AD 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)