Automated Aquarium Controller System Software Design ETEC 474

  • Slides: 17
Download presentation
Automated Aquarium Controller System Software Design ETEC 474 Western Washington University By: Gregory Rose

Automated Aquarium Controller System Software Design ETEC 474 Western Washington University By: Gregory Rose

Kernel Selection Micro. C/OS-II l Real-time preemptive multitasking kernel l Configured for my program

Kernel Selection Micro. C/OS-II l Real-time preemptive multitasking kernel l Configured for my program – Modify (os_cfg. h)

Priority of Tasks 4) 5) 6) 7) 8) 9) Start Task Clock Task User

Priority of Tasks 4) 5) 6) 7) 8) 9) Start Task Clock Task User Interface Task Key Task Control Task Main Task

Start Task Description: Ø Initializes system Ø Creates other tasks Ø Displays Startup message

Start Task Description: Ø Initializes system Ø Creates other tasks Ø Displays Startup message Priority #4 Period: once (at start-up) Execution time ~ 3 sec

Clock Task Description: Ø Calculates current time of day and date Priority #5 Period:

Clock Task Description: Ø Calculates current time of day and date Priority #5 Period: 1 sec (Periodic) Execution time ~ 1. 5 us (max)

User Interface Task Description: Ø Handles User inputs Allows users to set ü Time

User Interface Task Description: Ø Handles User inputs Allows users to set ü Time ü Temperature ü p. H Range ü Lamp times ü Feeding Amount ü Scheduled Water Change Priority #6 Period: 0. 5 sec (Sporaidc) Execution time ~ 1. 7 ms (max)

Key Task Description: Ø Reads the keypad and updates the buffer Priority #7 Period:

Key Task Description: Ø Reads the keypad and updates the buffer Priority #7 Period: 10 ms (Periodic) Execution time ~ 2. 2 us (max)

Control Task Description: Ø Read inputs and controls output LEDs, relays, and motor. Priority

Control Task Description: Ø Read inputs and controls output LEDs, relays, and motor. Priority #8 Period: 1 sec (Periodic) Execution time ~ 1. 5 us (max)

Main Task Description: Ø Get A/D conversions Ø Updates the main operating screen Displays

Main Task Description: Ø Get A/D conversions Ø Updates the main operating screen Displays current Date, Time, Temperature, and p. H when in main operating mode Priority #9 Period: 1 sec (Periodic) Execution time ~ 1. 9 ms (max)

ISR Description: Ø Generate a semaphore every one second for Clock Task to calculate

ISR Description: Ø Generate a semaphore every one second for Clock Task to calculate current time. Period: 1 ms (Periodic) Execution time ~ 291 ns (max)

CPU load L max= (1. 5 us) + (1. 7 ms) + (2. 2

CPU load L max= (1. 5 us) + (1. 7 ms) + (2. 2 ms) + (1. 5 us) + (1. 9 ms) + (291 ns) (1 s) ( 0. 5 s) (10 ms) L max= 22. 6% L average = 9. 2% (1 s) (1 ms)

Modules Main. c ATC. c Clock. c LCD. c Key. c Control. c Tasks

Modules Main. c ATC. c Clock. c LCD. c Key. c Control. c Tasks Start. Task UITask Main Task Correct. Time() Lcd. Key Time. Key The. Date Time. Of. Day Number. Array UIState temp ph err input settemp phhigh phlow feeding lampon lampoff waterchange Clock. Task Atd. Init() Atd. Temp. Read Atd. Ph. Read() temp Functions and Data Correct. Time() Lcd. Key Time. Key The. Date Time. Of. Day Lcd. Init() Lcd. Clr. Disp() Lcd. Disp. Char() Lcd. Disp. Strg() Lcd. Move. Cursor() Lcd. Disp. Temp() Lcd. Disp. Ph() Lcd. Disp. Time() Lcd. Cursor() Key. Task Control. Task Get. Key() Key. Init() Key. Flag The. Date Time. Of. Day temp ph settemp phhigh phlow feeding lampon lampoff

Data Flow Diagrams Keypad Application Keypad I/O Keypad Driver Module Key. Init() Key. Task()

Data Flow Diagrams Keypad Application Keypad I/O Keypad Driver Module Key. Init() Key. Task() key Key. Code. Table Key. Pend() Key. Flag

Data Flow Diagrams LCD Main. c LCD Driver Module LCD Display UITask Lcd. Key

Data Flow Diagrams LCD Main. c LCD Driver Module LCD Display UITask Lcd. Key Display. Main. Task LCD

Data Flow Diagrams ISR Clock. c Clock. Task Main. c Pend Post One. Second

Data Flow Diagrams ISR Clock. c Clock. Task Main. c Pend Post One. Second Timer Channel ISR OCOIsr IOC 0

Data Flow Diagrams A to D Ato. D. c AD Converter ATDCTL 5 A-to–D

Data Flow Diagrams A to D Ato. D. c AD Converter ATDCTL 5 A-to–D I/O Ts = 1 sec PAD 00 Atd. Temp. Read() Atd. Ph. Read() ADRODR 0 H ADRODR 1 H AN 0 -1 PAD 01

Data Flow Diagrams Control Items main. c Main. Task ph control. c temp settemp

Data Flow Diagrams Control Items main. c Main. Task ph control. c temp settemp phhigh UITask clock. c Control Task Clock. Task phlow feeding The. Date lampon Time. Of. Day lampoff waterchange Time. Key