Presentation is loading. Please wait.

Presentation is loading. Please wait.

National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 6: Serial Communication Prof. Chung-Ta King Department of Computer Science National.

Similar presentations


Presentation on theme: "National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 6: Serial Communication Prof. Chung-Ta King Department of Computer Science National."— Presentation transcript:

1 National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 6: Serial Communication Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan

2 National Tsing Hua University Lab 6 Write a function flash(char id, int on, int off) to flash the LEDs by interrupts using Timer1_A3 driven by ACLK sourced from VLO, where  id = 0 for red LED; 1 for green LED  on/off = time (in ms) for the LED to be on/off  CPU enters LPM3 between interrupts Write a function temp(int interval, int times) to measure the temperature using repeat-single- conversion mode triggered by Timer0_A3  interval: the interval (in ms) between measurements  times: the number of times to measure  Results are stored in a global integer array Temp[64] 1

3 National Tsing Hua University Lab 6 Normal:  Use flash() to flash the green LED at 0.5 Hz (0.5 sec on and 1.5 sec off) by interrupts (ACLK sourced from VLO  Use temp() to measure the temperature at 1 Hz continuously (Hint: must reuse Temp[]) Special:  If the average temperature of the last 2 seconds is higher than 737 (voltage), then flash the red LED at 2 Hz (0.2 sec on and 0.3 sec off) and send a string “Hot!” to PC every second using 7-E-1 (7-bit data, even parity, 1 stop bit). You must use 7-E-1 to get the full credit! 2

4 National Tsing Hua University Lab 6 Special: (cont.)  Whenever PC receives the string “Hot!”, it displays the string and waits for user’s input.  When user enters a string, PC transmits the string to the LaunchPad using 7-E-1  If the string is “Ack!”, then the LaunchPad goes back to the normal state (i.e. flash the green LED at 0.5 Hz with 0.5 sec on and 1.5 sec off). Otherwise, the LaunchPad ignores the string and keeps flashing the red LED at 2 Hz. 3


Download ppt "National Tsing Hua University CS4101 Introduction to Embedded Systems Lab 6: Serial Communication Prof. Chung-Ta King Department of Computer Science National."

Similar presentations


Ads by Google