ECE 3567 3567 Labor orator ory # # 2 Analog t og to Di - - PowerPoint PPT Presentation

ece 3567 3567
SMART_READER_LITE
LIVE PREVIEW

ECE 3567 3567 Labor orator ory # # 2 Analog t og to Di - - PowerPoint PPT Presentation

ECE 3567 3567 Labor orator ory # # 2 Analog t og to Di Digital C Converter and The Temperature M Mode Dr. Gregg Chapman 2018 Steps to Performing the Laboratory 1. Download C files and add them to your Lab #1 project 2. Write the


slide-1
SLIDE 1

ECE 3567 3567

Labor

  • rator
  • ry #

# 2 Analog t

  • g to Di

Digital C Converter and The Temperature M Mode

  • Dr. Gregg Chapman

2018

slide-2
SLIDE 2
  • 1. Download C files and add them to your Lab #1 project
  • 2. Write the Init_ADC12() routine in ADC12.c
  • 3. Edit the ADC12 Interrupt Service Routine
  • 4. Comment out the ADC12_VECTOR in unused_interrupts.c
  • 5. Add the Temperature Mode and LCD Commands to parse_Command()
  • 6. Add the decoding to change the LED color according to the temperature map
  • 7. Modify the infinite while loop in main.c to run tempSensor() whenever there is a Timer A0 ISR, But ONLY

if you are in the Temperature Mode.

  • 8. Modify the infinite while loop in main.c to run update_RGB() whenever there is a Timer A0 ISR, but only

if the LED_Test AND the LED_Control are enabled. 9. Remove the update_RGB at the end of parse_Command

  • 10. Add Init_ADC12() in main.c
  • 11. Add tempSensorModeInit() in main.c

Steps to Performing the Laboratory

slide-3
SLIDE 3
  • 1. Download C files and add them to your Lab #1 project

The download should include the following

  • files. Be sure to add them ALL to your project.
  • TempSensorMode.c
  • tempSensorModeInit()
  • tempSensor()
  • displayTemp()
  • TempSensorMode.h
  • myLCD.c
  • myLCD.h
  • ADC12.c
  • Init_ADC12()
  • ADC12_ISR()
slide-4
SLIDE 4
  • 2. Write the Init_ADC12() routine in ADC12.c
slide-5
SLIDE 5
  • 3. Edit the ADC12 Interrupt Service Routine
slide-6
SLIDE 6
  • 4. Comment out the ADC12_VECTOR in unused_interrupts.c
slide-7
SLIDE 7
  • 5. Add the Temperature Mode and LCD Commands

to parse_Command()

slide-8
SLIDE 8

TE – Temperature Mode Enable

To set up the temperature mode, you must:

  • Disable all other Modes and their Control variables:

LED_Test , T_Control, RC_Control

  • Enable the Temperature Sensor Mode (T_Measure)
  • Enable the LED and LCD Control
  • Clear the temperature variables: k, sum, deg
  • Clear the Flash variables: toggle, Flash
  • Clear the current color from the LED
  • Clear the LCD_Display
slide-9
SLIDE 9

TD – Temperature Mode Disable

  • Disable the Control Variables for LCD and LED and

Temperature

  • Disable Temperature Sensor Mode (T_Measure)
  • Turn OFF the LED (use a function)
  • Clear the LCD_Display
slide-10
SLIDE 10

TC – Temperature in Celsius

  • Verify that tempUnit is not already set to Celsius
  • If it’s not, change it to the Celsius state.
  • Re-initialize k, sum, and deg.

(WARNING – Don’t call tempSensorModeInit() to do this. That function get’s modified in the next lab)

slide-11
SLIDE 11

TF – Temperature in Fahrenheit

  • Verify that tempUnit is not already set to Fahrenheit
  • If it’s not, change it to the Fahrenheit state.
  • Re-initialize k, sum, and deg.

(WARNING – Don’t call tempSensorModeInit() to do this. That function get’s modified in the next lab)

slide-12
SLIDE 12

DE – Enable the LCD Display

  • Use the variable LCD_Control to enable and disable the LCD Display
  • Clear the LCD when enabling or disabling
slide-13
SLIDE 13

DD – Disable the LCD Display

  • Use the variable LCD_Control to enable and disable the LCD Display
  • Clear the LCD when enabling or disabling
slide-14
SLIDE 14
  • 6. Add the decoding to change the LED color according to the

temperature map

Should be added at the beginning of update_RGB()

slide-15
SLIDE 15
  • 7. Modify the infinite while loop in main.c to run tempSensor()

if(T_Measure == TRUE) // Temperature Measurement Mode { tempSensor(); }

Should be added to run if the ISR_Flag is set.

slide-16
SLIDE 16
  • 8. Modify the infinite while loop in main.c to run update_RGB()

else if((LED_Test == TRUE) && (LED_Control == TRUE)) { update_RGB(); }

Should be added to run if the ISR_Flag is set.

slide-17
SLIDE 17
  • 9. Remove the update_RGB at the end of parse_Command

It now runs in the main() on the TimerA0 ISR

slide-18
SLIDE 18
  • 10. Add Init_ADC12() in main.c
slide-19
SLIDE 19
  • 11. Add tempSensorModeInit() in main.c
slide-20
SLIDE 20

Laboratory #2 Checkpoints

  • 1. Have the Lab Monitors check your Init_ADC12() routine
  • 2. Temperature Commands work correctly (TE, TC, TF, TD)
  • 3. LED Colors work correctly from room temperature down to 65 degrees Fahrenheit

( use cold spray)

  • 4. LCD Enable and Disable Works (DE, DD)
  • 5. LED Enable and Disable still works (LD, LE)