130 likes | 240 Views
Conserve-A-Watt. System Software Design Justin Rapozo. General System Description. MC9S12DP512 24MHz Bus Frequency 16K bytes RAM, 4K bytes EEPROM, 512K bytes Flash EEPROM Memory Required 2K bytes RAM 36K bytes Flash EEPROM Kernel Used MicroC/OS-II 1 ms tick period. Tasks. Start Task
E N D
Conserve-A-Watt System Software Design Justin Rapozo
General System Description • MC9S12DP512 • 24MHz Bus Frequency • 16K bytes RAM, 4K bytes EEPROM, 512K bytes Flash EEPROM • Memory Required • 2K bytes RAM • 36K bytes Flash EEPROM • Kernel Used • MicroC/OS-II • 1 ms tick period
Tasks • Start Task • UI Task • Key Task • Energy Meter Task
Start Task • Creates the User Interface Task, Energy Metering Task, and Key Task • Priority: 4 • Period: Once (at startup) • Execution Time: ~1s
Energy Metering Task • Handles measuring energy usage of the device under test. • Irms • Vrms • Calculates Preal. • Calculates energy consumption in kWh. • Handles the storing and deleting of energy consumption. • Priority: 5 • Period: 1ms • Execution Time: 200µs
Key Task • Checks for key presses so as to give the user options • Priority: 6 • Period: 5ms • Execution Time: ≤ 5µs
UI Task • Handles user inputs and Displays real time/saved energy measurements. • Priority: 7 • Period: 500ms • Execution Time: 4ms (max)
CPU Load • EnergyMeterTask Load: 200µs/1ms = 0.2 • KeyTask Load: 5µs/5ms = 0.01 • UITask Load: 4ms/500ms = 0.008 Total CPU Load(Max) = 0.1+0.01+0.008 = 0.218 x 100% = 21.8% Average CPU Load = 20.8%
Main Dataflow Hardware EnergyMain.c Hardware Meter.c ReadCurrent() ReadVoltage() Buttons LCD KeyTask UITask Key Energy Flag EnergyMeterTask
A to D Dataflow AtoD.c A/D Converter AtoDI/O AtoDInitialize() 1ms ReadCurrent() PAD00 PAD01 ReadVoltage() ATDCTL5 AN0-1 ADR0DR0H A/D ADR0DR1H
FlashEEPROM Dataflow UITask EnergyMain.c Hardware FlashEEPROM Meter.c EnergyMutex Key EnergyMeterTask
Questions? Comments?