Keil RTX51 Manual page 52

Table of Contents

Advertisement

52
init () _task_ INIT
*/
serial_init ();
*/
os_create_task
*/
os_create_task
*/
os_create_task
*/
os_create_task
*/
os_delete_task (INIT);
*/
}
bit display_time = 0;
*/
/*****************************************************************************
*/
/*
*/
/*****************************************************************************
*/
clock ()
while (1)
*/
if
*/
*/
*/
}
6
if (display_time)
*/
*/
}
os_wait
*/
}
}
struct time rtime;
*/
/*****************************************************************************
*/
/*
*/
/*****************************************************************************
*/
bit readtime (char idata *buffer)
{
(CLOCK);
(COMMAND);
(LIGHTS);
(KEYREAD);
_task_ CLOCK
{
{
(++ctime.sec
==
60)
ctime.sec = 0;
if
(++ctime.min
==
ctime.min = 0;
if
(++ctime.hour
==
ctime.hour = 0;
}
}
{
os_send_signal (COMMAND);
(K_IVL,
100,
0);
readtime: convert line input to time values & store in rtime
/* program execution starts here
/* initialize the serial interface
/* stop init task (no longer needed)
/* flag:
signal cmd state display_time
/* clock is an endless loop
{
60)
{
24)
{
/* if command_status == display_time
/* signal to task command: time changed
/*
/* temporary storage for entry time
{
Application Examples
/*
start
clock
/*
start
command
/*
start
lights
/*
start
keyread
Task
2
'clock'
/*
calculate
the
second
/*
calculate
the
minute
/*
calculate
the
wait
interval:
1
second
task
task
task
task
hour

Advertisement

Table of Contents
loading

Table of Contents