ece 3567 3567
play

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


  1. ECE 3567 3567 Labor orator ory # # 2 Analog t og to Di Digital C Converter and The Temperature M Mode Dr. Gregg Chapman 2018

  2. Steps to Performing the Laboratory 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

  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()

  4. 2. Write the Init_ADC12() routine in ADC12.c

  5. 3. Edit the ADC12 Interrupt Service Routine

  6. 4. Comment out the ADC12_VECTOR in unused_interrupts.c

  7. 5. Add the Temperature Mode and LCD Commands to parse_Command()

  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

  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

  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)

  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)

  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

  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

  14. 6. Add the decoding to change the LED color according to the temperature map Should be added at the beginning of update_RGB()

  15. 7. Modify the infinite while loop in main.c to run tempSensor() Should be added to run if the ISR_Flag is set. if(T_Measure == TRUE) // Temperature Measurement Mode { tempSensor(); }

  16. 8. Modify the infinite while loop in main.c to run update_RGB() Should be added to run if the ISR_Flag is set. else if((LED_Test == TRUE) && (LED_Control == TRUE)) { update_RGB(); }

  17. 9. Remove the update_RGB at the end of parse_Command It now runs in the main() on the TimerA0 ISR

  18. 10. Add Init_ADC12() in main.c

  19. 11. Add tempSensorModeInit() in main.c

  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)

Recommend


More recommend