home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 September
/
pcwk_09_96.iso
/
demo
/
wgelectr
/
pk51demo
/
files.2
/
EXAMPLES
/
TDP
/
MAIN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-08
|
2KB
|
61 lines
/*------------------------------------------------------------------------------
MAIN.C: Main C function and program loop.
Copyright 1995 KEIL Software, Inc.
------------------------------------------------------------------------------*/
#include <reg51.h>
#include <stdlib.h>
#include "tdp.h"
/*------------------------------------------------------------------------------
void main (void);
This is the main C function.
------------------------------------------------------------------------------*/
void main (void)
{
unsigned i;
/*------------------------------------------------
Do nothing for a few microseconds to let the power
system stabalize.
------------------------------------------------*/
for (i = 0; i < 1000; i++); /* wait for 1000 counts */
/*------------------------------------------------
Initialize the timer tick ISR.
Initialize the serial I/O ISR.
------------------------------------------------*/
timer0_initialize ();
com_initialize ();
/*------------------------------------------------
------------------------------------------------*/
timer0_wait (TIMER0_TICKS_PER_SEC / 10);
clock_init ();
com_puts ("TDP V1.0\r\n");
/*------------------------------------------------
------------------------------------------------*/
while (1)
{
const char *cmd;
cmdb_init ();
cmdb_prompt ();
for (cmd = NULL; cmd == NULL; cmd = cmdb_scan ())
{
clock_update ();
}
cmd_proc (cmd);
}
}
/*------------------------------------------------------------------------------
------------------------------------------------------------------------------*/