//PROJECT : EA21
//IC : SAMSUNG S3C9454
#include "ioS3C9454.h"
//自己编写,注意const ?
//****************************
// PIN define area
//*****************************
#define CONTROL_RelayLight (P0&0x04) //P0.2
#define SET_RelayLight (P0|=0x04)
#define CLR_RelayLight (P0&=0xFB)
#define CONTROL_RelayCyclone (P0&0x08) //P0.3
#define SET_RelayCyclone (P0|=0x08)
#define CLR_RelayCyclone (P0&=0xF7)
//*********************************
//function declare area
//*********************************
void io_init(void);
void delay(void);
void AD_CONV(void);
void MOV ingData(void);
void JudgingKey(void);
void DealKey(void);
void DealDelayClose(void);
void DealDelayLOCk(void);
void DealBuzz(void);
void DealLockMotor(void);
void ram_init(void);
//*********************************
//constant define area
//*********************************
#define DelayKey 0x01
#define PowerKey 0x02
#define CycloneKey 0x04
#define LightKey 0x08
#define LockKey 0x10
#define BigWindKey 0x20
#define SILenceKey 0x40
//*********************************
//variable define area
//*********************************
unsigned char VolData[7][5]; //如果上电前,即使按键按下,也不识别,那么,初始化为0就可以,
//如果需要识别,就要处理??
unsigned char Key_OldStatus; //表示前一时刻键的状态,1表示按下,0表示弹起
unsigned char RepeatKey_Status; //表示重键的状态,1表示有,0表示无,对应七个键
unsigned char Key_NowPushStatus; //表示现在键按下的状态
#define CONTROL_LockStatus (SYS_Status&0x01)
#define SET_LockStatus (SYS_Status|=0x01)
#define CLR_LockStatus (SYS_Status&=0xFE)
//*********************************
//table define area
//*********************************
//code unsigned char AnalogChannel[7]={0x00,0x00,0x01,0x01,0x02,0x02,0x03};
//code unsigned char ADChannel[7]={0x05,0x15,0x05,0x15,0x05,0x15,0x15};
//*********************************
//SUB PROGRAM ROUTINE
//*********************************
void io_init(void)
{
CLKCON = 0x18; // cpu clock is non-divided clock
BTCON = 0xA3; // dISAble watch-dog, select fxx/4096 for basic timer clock
//btcon = 0x02, enable watch-dog
SP = 0xC0; // sp
全部0条评论
快来发表一下你的评论吧 !