?? ioport.c
字號:
/***********************************************************************/
/* */
/* FILE :ioport.c */
/* DATE :Tue, Jun 07, 2005 */
/* DESCRIPTION :I/O port */
/* CPU TYPE :Other */
/* */
/* This file is coded by RSBJ WRD */
/* */
/***********************************************************************/
#include "ioport.h"
/****************************************
Function Description: i/o initialization
Input paras: void
Output paras: void
Return value: void
****************************************/
void ioport_ini (void)
{
prc2 = 1,
#ifdef M30280f8
pacr = 0x03;//80-85pin
#endif
#ifdef M30280
pacr = 0x02;// 64-pin
#endif
prc2 = 0;
pd1 = 0;
//pd6 = 0;
pd7 = 0;
//pd8 = 0;
p9 = 0x00;
prc2 = 1,
pd9 = 0x07,//42pin/*0x07, // 48-pin*
prc2 = 0;
p10 = 0;
pd10 = 0xe0; /* using for simulator motor */
pur0 = 0;
pur1 = 0;
pur2 = 0;
prc2 = 1,
#ifdef THREEGEN
nddr = 200 -1, //(16MHz/8/200: 100us)
#else
#ifdef FOURGEN
nddr = 20 -1,//(16MHz/8/20: 20--10us)
#else
NO NDDR ASSIGNMENT
#endif
#endif
prc2 = 0;
//p17ddr = 0xff;// disable debounce
}
/*********************************************
Function Description: PTC relay delay close
Input paras: void
Output paras: void
Return value: void
**********************************************/
UINT_8 PTC_OUT = 0xff;
void PTC_out(void)
{
static UINT_16 PTCdelaycnt = 250;
static UINT_16 PTCdelaycnt2 = 250;
if (PTCdelaycnt > 0)
{
PTC_OUT = 0xff;
PTC_OP(0);
PTCdelaycnt -- ;
}
else
{
PTC_OP(1);
if ( PTCdelaycnt2 > 0 )
{
PTC_OUT = 0xff;
PTCdelaycnt2 --;
}
else
{
PTC_OUT = 0;
}
}
}
/****************************************
Function Description: Run LED
Input paras: void
Output paras: void
Return value: void
****************************************/
void LEDV605_flash ( const UINT_8 period ,const UINT_8 flashsw )
{
static UINT_8 flashcnt = 0;
if ( 0 != flashsw )
{
if ( flashcnt < period )
{
flashcnt ++;
}
else
{
LED605 = ~ LED605;
LED605DIR = 1;
flashcnt = 0;
}
}
else
{
flashcnt = 0;
}
}
/****************************************
Function Description: Error LED
Input paras: void
Output paras: void
Return value: void
****************************************/
static const UINT_8 flash_intval = 100; //10sec
void LEDV604_flash ( const UINT_8 period ,const UINT_8 flashsw,const UINT_8 flashtimes )
{
static UINT_8 flashcnt = 0;
static UINT_8 flashno = 0;
static UINT_8 flash_intvalcnt = 0;
if ( 0 != flashsw )
{
if ( flashno < flashtimes )
{
if ( flashcnt < period )
{
flashcnt ++;
}
else
{
LED604 = ~ LED604;
LED604DIR = 1;
flashcnt = 0;
}
flashno ++ ;
}
else
{
if ( flash_intvalcnt <flash_intval )
{
LEDV604_OP(1);
flash_intvalcnt ++;
}
else
{
flash_intvalcnt = 0;
flashno = 0;
}
}
}
else
{
flashcnt = 0;
LEDV604_OP(1);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -