SOLAR POWERED FIELD WEATHER STATION System Software Design Dean Zimmermann WWU Spring 2010
General System Design Freescale 9S08QE128 Microcontroller 24 MHz Bus Frequency Available Memory: 128K Flash/8K RAM Required Memory: 10K Flash/4K RAM Timeslice Kernel – 10ms Period
Timeslice Kernel Tasks • Timeslice Task • User Interface Task • Clock Task • Sensor Task • SD-Card Write/Read Task • Key Task
Timeslice Task Period: 10ms Waits for periodic timing event to initialize task loop Puts the MCU to sleep to save power
User Interface Task Period: 50ms (periodic) Execution Time ~ 2ms (max) Displays information on the LCD and controls LEDs Handles user inputs to: Change State Set Time and Date Set Sample Rate Navigate Stored Data
Clock Task Period: 1s (periodic) Execution Time ~ 4us (max) Updates Time and Date information
Sensor Task Period: 500ms (periodic) Execution Time ~ 3ms (max) Receives information on A/D convertor Reads timer channel Communicates with pressure module through SPI Performs necessary calculations and uses lookup tables to convert data into meaningful forms
SD-Card Write/Read Task Period: Sample Rate (sporadic) Execution Time ~ 1 ms (max) Uses SPI to communicate with SD-Card module Writes data to SD-Card Writes at the sample rate specified by user Stores data blocks with time and date stamp Reads Data blocks to display on LCD
Key Task Period: 10ms (periodic) Execution Time ~ 2 us (max) Checks for key presses Updates key buffer
CPU Load Maximum
Modules Module Tasks Public Functions and Data Author Main.c User Interface Task Current State Data Dean Zimmermann Timeslice Task Current Time/Date Data Struct Local Time/Date Data Struct Time.c Clock Task Time_DateGet(), Time_DateSet() Dean Zimmermann Weather.c SD-Card R/W Task Weather Data Structure Dean Zimmermann Sensor Task WeatherDataGet() Key.c Key Task KeyInit() Todd Morton GetKey() SPIDriver.c - InitSPI(), Read SPI(), WriteSPI() Dean Zimmermann LCD.c - LcdClrDisp(), LcdDispChar() Todd Morton LcdDispByte(), LcdDispString() LcdMoveCursor(), LcdCursor() OCDelay.c - OCDelay(), GetmsCnt() Todd Morton
Overall State Diagram Past LIVE/PAST LIVE/PAST REC Live SET Record (reset) REC Button SET’ Hold SET SET Set (3 sec.)
Data Flow: Sensors ADC I/O Weather.c SPIDriver.c Weather Data Structure PTF0 PTF1 Sensor Task SpiRead() Timer 3 Channel 0
Data Flow: SD-Card Main.c Weather.c SPIDriver.c Weather Data Structure SpiRead() Time/Date Time_DateGet() SD-Card R/W Data Structure Task SpiWrite()
Data Flow: User Interface-Display Weather.c Main.c Time.c Time/Date Time_DateGet() Data Structure Time_DateSet() Clock Task Weather Data User Interface Structure Task WeatherDataGet() Port E LCD Display
Data Flow: User Interface-Keypad Main.c Key.c Port B GetKey() User Interface Key Task Task
Questions?
Recommend
More recommend