VANDERBILT EECE 276 - Timer functions (6 pages)
Previewing pages 1, 2 of 6 page document View the full content.Timer functions
Previewing pages 1, 2 of actual document.
View the full content.View Full Document
Timer functions
0
0
99 views
- Pages:
- 6
- School:
- Vanderbilt University
- Course:
- Eece 276 - Embedded Systems
EECE 276 Embedded Systems Timer functions and events EECE 276 Embedded Systems 1 Timer functions O Real time systems often must synchronize their activities to the passage of time Turn power off if nothing happens for 1 mins Dial a digit 100msec tone 100msec pause If temp and press is too high continuously for 3 minutes then shut down reactor O Common technique delay int units delays task for a units delay call int units void func void void arg call func with arg after units EECE 276 Embedded Systems 2 Timer example code void phone dial task char phNum MAX PH NUM 0 terminated phone number str char phNumP while 1 msgq recv queue phNum MAX PH NUM Get numbers phNumP phNum while phNumP delay 100 delay for 100 mSec dialToneOn phNumP 0 start tone delay 100 delay for 100 msec dialToneOff stop tone phNumP next digit EECE 276 Embedded Systems 3 Issues with timers O The delay int may not precisely delay delay 3 2 9 ticks delay 3 2 9 ticks delay 3 2 3 ticks O O tick delay ends at tick No standard tick read RTOS manual More accurate timing use hardware timers EECE 276 Embedded Systems 4 Events Synchronization devices O O O event boolean flag Multiple tasks can set it wait for it A task can wait for multiple events AND and OR synchronization O uCOS Event flag groups See App Note EECE 276 Embedded Systems 5 Comparison of task synchronization tools O Semaphores Fast and simple Unstructured Limited information is carried O Events Slightly more complex than semaphores Multiple tasks for one event One task for multiple events O Queues Pass large amounts of data Enqueuing dequeuing data is expensive EECE 276 Embedded Systems 6
View Full Document