56
Application Examples
6
yellow = 1; /* yellow light on
*/
os_wait (K_TMO, 30, 0); /* wait for timeout: 30 ticks
*/
yellow = 0; /* yellow light off
*/
os_wait (K_TMO, 30, 0); /* wait for timeout: 30 ticks
*/
if (signalon ()) { /* if blinking time over
*/
os_create_task (LIGHTS); /* start lights
*/
os_delete_task (BLINKING); /* and stop blinking
*/
}
}
}
/*****************************************************************************
*/
/* Task 4 'lights': executes if current time is between start & end time
*/
/*****************************************************************************
*/
lights () _task_ LIGHTS { /* traffic light operation
*/
red = 1; /* red & stop lights on
*/
yellow = 0;
green = 0;
stop = 1;
walk = 0;
while (1) { /* endless loop
*/
os_wait (K_TMO, 30, 0); /* wait for timeout: 30 ticks
*/
if (!signalon ()) { /* if traffic signal time over
*/
os_create_task (BLINKING); /* start blinking
*/
os_delete_task (LIGHTS); /* stop lights
*/
}
yellow = 1;
os_wait (K_TMO, 30, 0); /* wait for timeout: 30 ticks
*/
red = 0; /* green light for cars
*/
yellow = 0;
green = 1;
os_clear_signal (LIGHTS);
os_wait (K_TMO, 30, 0); /* wait for timeout: 30 ticks
*/
os_wait (K_TMO + K_SIG, 250, 0); /* wait for timeout & signal
*/
yellow = 1;
green = 0;
os_wait (K_TMO, 30, 0); /* wait for timeout: 30 ticks
*/
red = 1; /* red light for cars
*/
yellow = 0;
Содержание RTX51
Страница 4: ......
Страница 6: ......
Страница 20: ......
Страница 24: ......
Страница 39: ...RTX Tiny 39 4...
Страница 40: ......
Страница 44: ...44 RTX51 Tiny Specifications 5...
Страница 68: ...RTX51 TINY REAL TIME OPERATING SYSTEM User s Guide 2 95...