Lập trình hệ thống nhúng, Kỹ thuật lập trình, Nguồn thông điệp LCD | ARM PROGRAMMING Bùi Qu c B o Why use RTOS •Three sources of LCD messages •Mix of fast and slow hardware •Mix of continuous, periodic, event driven, high priority and low priority requirements BÙI QU C B O 1 Why use RTOS Concurrent processing BÙI QU C B O 2 Scheduler Scheduler là 1 ph n c a kernel dùng ñ quy t ñ nh tác v nào ñư c ch y t i m i th i ñi m. Kernel có th d ng và ph c h i ho t ñ ng c a 1 tác v trong khi tác v ñang ch y. M t tác v có th d ng chính nó b ng cách delay (sleep) m t kho ng th i gian, ho c ch (block) ñ ñ i m t s ki n (vd: keypressed) hay 1 tài nguyên (vd: serialport) Scheduler BÙI QU C B O 3 Scheduler At (1) task 1 is executing. At (2) the kernel suspends task 1 . and at (3) resumes task 2. While task 2 is executing (4), it locks a processor peripheral for it's own exclusive access. At (5) the kernel suspends task 2 . . and at (6) resumes task 3. Scheduler Task 3 tries to access the same processor peripheral, finding it locked, task 3 cannot continue so suspends itself at (7). At (8) the kernel resumes task 1. Etc. The next time task 2 is executing (9) it finishes with the processor peripheral and unlocks it. The next time task 3 is executing (10) it finds it can now access the processor peripheral and this time executes until suspended by the kernel. BÙI QU C B O 4 Realtime scheduler M i tác v ph i ñáp ng (response) trong th i gian qui ñ nh (deadline). M i tác v có 1 m c ưu tiên riêng Scheduler s ñ m b o tác v có quy n ưu tiên cao luôn ñư c th c thi b ng cách t m d ng tác v có quy n ưu tiên th p. Realtime OS Response time: 0-100ms LCD Keypad Display output Analog Input ADC filter control Sample rate: 5Khz BÙI QU C B .