cindy Guest
|
timer and Flash |
Posted: Sat Jan 03, 2009 10:41 pm |
|
|
..........
Quote: | #define WAITKEY_TIMEOUT 75 /* at 15/second */
#define RESET_KBD_COUNT 75 /* at 15/second */
#use delay ( clock = 4000000, restart_wdt ) /* sets appropriate compiler constants */
#use fast_io ( A ) /* don't set TRIS on each I/O statement */
#use fast_io ( B )
#zero_ram
/* initialize EEPROM */
#rom 0x2100 = {
1, 2 , 3, 4, 5, 6, /* master combo (6) */
1, 5, ACTIVE, /* lamp time seconds (2) & ACTIVE flag (1) */
0, 1, ACTIVE /* lock time seconds (2) & ACTIVE flag (1) */
}
..............
void StartOpenLock ( char cCnt );
void StartLampTimer ( char cCnt );
void Flash ( void );
static long iLampCount, iLampLimit, iLockCount, iLockLimit;
static char cProgMode, cProgTimeoutCount, cResetKbdCount;
void main ( void )
{
...................
setup_counters ( RTCC_INTERNAL, RTCC_DIV_256 ); /* 65mS roll */
enable_interrupts ( INT_RTCC ); /* turn on timer interrupt */
enable_interrupts ( GLOBAL ); /* enable interrupts */
......................
#int_rtcc
void TimerInterrupt ( void ) /* 65mS tic */
{
if ( cProgMode == YES ) /* if in program mode */
{
if ( cProgTimeoutCount++ >= 8 )
{
ILL_OUT ^= 1; /* toggle lamp state */
cProgTimeoutCount = 0;
}
}
else /* if in normal mode */
{
if ( iLampCount++ > iLampLimit ) /* if timeout yet */
{
ILL_OUT = OFF; /* turn lamp off */
}
if ( cResetKbdCount++ > RESET_KBD_COUNT )
{
cKeyCnt = 0; /* reset to first key */
}
}
============================================= |
- void Flash ( void );
What is the purpsose?
- if ( cProgTimeoutCount++ >= 8 )
What is the "8" mean in this sentence?
|
|