Download presentation
Presentation is loading. Please wait.
Published byGavin Stephens Modified over 8 years ago
1
Turbine Flow Meter Kevin Hooks Senior Design Project
2
Overview Micro Controller Kernel, Tasks, CPU Load Data Flow Diagrams State Machine Diagrams Module, Public Tasks, Functions and Variables Questions?
3
Micro Controller HC9S12DP512 16-bit device 512K bytes Flash EEPROM, 14K bytes RAM, 4K bytes of EEPROM 2 SCI, 3 SPI, 8-channel IC/OC ECT, two 8- channel, 10-bit ADC, 8 channel PWM, 29 GPIO, 20 GPIO with interrupts 24 MHz Bus Frequency
4
Micro Controller About < 300 Kbytes Flash EEPROM 1 SCI 1 SPI 2 IC/IOC (1 input capture, 1 Pulse Accumulator)
5
Kernel Time Slicing Period of 1s Total Tasks 5 1 Interrupts
6
Tasks LCD_Update Pulse_Count Period_Count Thermo_Get Calculate_Values
7
LCD_Update Checks for Display Units Compares Current LCD Value with new LCD Value If different then update LCD display Run Time ~10ms max, ~1ms Average CPU Load ~ 10ms/1s = 10% max, ~1ms/1s = 1% average
8
Pulse_Count Counts Pulses for 10ms Stores Value in public variable *Pulse_Val Run Time ~10ms CPU Load ~10ms/1s = 10%, should always be 10ms
9
Period_Count Counts the period of one pulse Stores value in public Variable *Period_Val Run Time Varies based on Frequency (Max of 1ms at frequency of 10kHz average of.5ms at 50kHz) CPU Load ~1ms/1s = 1% max, ~.5ms/1s =.5% average
10
Thermo_Get Performs an SPI read for one 16-bit value from the MAX6675 and stores into variable Thermo_Val. Only 12 bits are used so it will need to be masked. At 24MHz clock the runtime is max ~10uS CPU Load = ~10us/1s =.001%
11
Calculate_Values Receives variables from each get task and performs a series of calculations to provide one final 8-bit result New_Value Checks for variable set by touch screen ISR to determine calculations for correct units Run Time ~10us CPU Load = ~10us/1s =.001%
12
Get_Touch ISR If a screen touch is detected, jump to ISR This ISR simply sets a variable to a specific value. This will be used to determine unit display Run Time is ~1uS
13
Final CPU Load Max CPU Load = 10ms/1s + 10ms/1s + 1ms/1s + 1us/1s + 1us/1s = 21.002% Average CPU Load = 16.502%
14
Data Flow Diagram: LCD_Update Task
15
Data Flow Diagram: Pulse_Count
16
Data Flow Diagram: Period_Count
17
Data Flow Diagram: Thermo_Get
18
Data Flow Diagram: Calculate_Values
19
Data Flow Diagram: SCI_Read_Isr
20
State Diagram for UI Initial State
21
Modules, Tasks, Public Data ModulesTasksPublic Functions and Data Main.cWaitForSlice(), LCD.c Modified from Trevor Wilcox LCD_Update()Prev_Val Disp_Val() Get_Touch() Compare_Val() SCI_read_Isr() Calculation.cCalculate_values()New_Val Unit_Val OCDelay.c Todd Morton SPI.cThermo_Get()Thermo_Val ECT.cPulse_Count(), Period_Count() Pulse_Val, Period_Val 9S12DP256Start.c Todd Morton
22
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.