Keil RTX51 Manual page 56

Table of Contents

Advertisement

56
yellow = 1;
*/
*/
yellow = 0;
*/
*/
if (signalon ())
*/
*/
*/
}
}
}
/*****************************************************************************
*/
/*
*/
/*****************************************************************************
*/
lights () _task_ LIGHTS
*/
red
*/
yellow = 0;
green
stop
walk
while (1)
*/
*/
*/
*/
6
*/
}
yellow = 1;
*/
red
*/
yellow = 0;
green
os_clear_signal (LIGHTS);
*/
os_wait (K_TMO + K_SIG, 250, 0);
*/
yellow = 1;
green
*/
red
*/
yellow = 0;
os_wait (K_TMO, 30, 0);
os_wait (K_TMO, 30, 0);
{
os_create_task
(LIGHTS);
os_delete_task (BLINKING);
Task 4 'lights': executes if current time is between start & end time
{
= 1;
= 0;
= 1;
= 0;
{
os_wait (K_TMO, 30, 0);
if (!signalon ())
{
os_create_task
(BLINKING);
os_delete_task
(LIGHTS);
os_wait (K_TMO, 30, 0);
= 0;
= 1;
os_wait (K_TMO, 30, 0);
= 0;
os_wait (K_TMO, 30, 0);
= 1;
Application Examples
/* yellow light on
/* wait for timeout: 30 ticks
/* yellow light off
/* wait for timeout: 30 ticks
/* if blinking time over
/*
start
/* and stop blinking
/* traffic light operation
/* red & stop lights on
/* endless loop
/* wait for timeout: 30 ticks
/* if traffic signal time over
/*
start
blinking
/*
stop
/* wait for timeout: 30 ticks
/* green light for cars
/* wait for timeout: 30 ticks
/* wait for timeout & signal
/* wait for timeout: 30 ticks
/* red light for cars
lights
lights

Advertisement

Table of Contents
loading

Table of Contents