turbine flow meter kevin hooks senior design project

22
Turbine Flow Meter Kevin Hooks Senior Design Project

Upload: gavin-stephens

Post on 06-Jan-2018

225 views

Category:

Documents


3 download

DESCRIPTION

Micro Controller HC9S12DP 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

TRANSCRIPT

Page 1: Turbine Flow Meter Kevin Hooks Senior Design Project

Turbine Flow Meter

Kevin HooksSenior Design Project

Page 2: Turbine Flow Meter Kevin Hooks Senior Design Project

Overview

• Micro Controller• Kernel, Tasks, CPU Load• Data Flow Diagrams• State Machine Diagrams• Module, Public Tasks, Functions and Variables• Questions?

Page 3: Turbine Flow Meter Kevin Hooks Senior Design Project

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

Page 4: Turbine Flow Meter Kevin Hooks Senior Design Project

Micro Controller

• About < 300 Kbytes Flash EEPROM• 1 SCI • 1 SPI• 2 IC/IOC (1 input capture, 1 Pulse

Accumulator)

Page 5: Turbine Flow Meter Kevin Hooks Senior Design Project

Kernel

• Time Slicing• Period of 1s• Total Tasks 5• 1 Interrupts

Page 6: Turbine Flow Meter Kevin Hooks Senior Design Project

Tasks

• LCD_Update• Pulse_Count• Period_Count• Thermo_Get• Calculate_Values

Page 7: Turbine Flow Meter Kevin Hooks Senior Design Project

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

Page 8: Turbine Flow Meter Kevin Hooks Senior Design Project

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

Page 9: Turbine Flow Meter Kevin Hooks Senior Design Project

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

Page 10: Turbine Flow Meter Kevin Hooks Senior Design Project

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%

Page 11: Turbine Flow Meter Kevin Hooks Senior Design Project

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%

Page 12: Turbine Flow Meter Kevin Hooks Senior Design Project

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

Page 13: Turbine Flow Meter Kevin Hooks Senior Design Project

Final CPU Load

• Max CPU Load = 10ms/1s + 10ms/1s + 1ms/1s + 1us/1s + 1us/1s = 21.002%

• Average CPU Load = 16.502%

Page 14: Turbine Flow Meter Kevin Hooks Senior Design Project

Data Flow Diagram: LCD_Update Task

Page 15: Turbine Flow Meter Kevin Hooks Senior Design Project

Data Flow Diagram: Pulse_Count

Page 16: Turbine Flow Meter Kevin Hooks Senior Design Project

Data Flow Diagram: Period_Count

Page 17: Turbine Flow Meter Kevin Hooks Senior Design Project

Data Flow Diagram: Thermo_Get

Page 18: Turbine Flow Meter Kevin Hooks Senior Design Project

Data Flow Diagram: Calculate_Values

Page 19: Turbine Flow Meter Kevin Hooks Senior Design Project

Data Flow Diagram: SCI_Read_Isr

Page 20: Turbine Flow Meter Kevin Hooks Senior Design Project

State Diagram for UI

Initial State

Page 21: Turbine Flow Meter Kevin Hooks Senior Design Project

Modules, Tasks, Public DataModules Tasks Public Functions and Data

Main.c WaitForSlice(),

LCD.cModified from Trevor Wilcox

LCD_Update() Prev_ValDisp_Val()Get_Touch()Compare_Val()SCI_read_Isr()

Calculation.c Calculate_values() New_ValUnit_Val

OCDelay.cTodd MortonSPI.c Thermo_Get() Thermo_Val

ECT.c Pulse_Count(), Period_Count()

Pulse_Val, Period_Val

9S12DP256Start.cTodd Morton

Page 22: Turbine Flow Meter Kevin Hooks Senior Design Project

Questions?