//PROJECT : EA21
//IC : SAMSUNG S3C9454
#include "ioS3C9454.h"
//自己編寫,注意const ?
//****************************
//PINdefine 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
#defineSILenceKey 0x40
//*********************************
//variable define area
//*********************************
unsigned char VolData[7][5]; //如果上電前,即使按鍵按下,也不識別,那么,初始化為0就可以,
//如果需要識別,就要處理??
unsigned char Key_OldStatus; //表示前一時(shí)刻鍵的狀態(tài),1表示按下,0表示彈起
unsigned char RepeatKey_Status; //表示重鍵的狀態(tài),1表示有,0表示無,對應(yīng)七個(gè)鍵
unsigned char Key_NowPushStatus; //表示現(xiàn)在鍵按下的狀態(tài)
#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
-
S3C9454
+關(guān)注
關(guān)注
0文章
1瀏覽量
1112
發(fā)布評論請先 登錄
相關(guān)推薦
評論