Docsity

Lab Assignment 4 - Introduction to Embedded Computer Systems | CPE 323, Assignments of Engineering

Toggle sidebar
bg1
CPE/EE 323: Laboratory Assignment 4
Purpose: To study MSP430 and learn how to utilize the Basic Clock Module, the TimerA, and
the UART.
Assignment #1 (10 points): Blink the Status LED using TimerA
Write a C program that toggles the status LED on the EasyWeb2 development board with
frequency of 1Hz (approx. 1s is on, and 1s is off). Use the high frequency crystal for MCLK
(8MHz) and ACLK (1MHz), and TimerA. Change parameters to increase toggle frequency to
2Hz and to decrease it to 0.5Hz.
Assignment #2 (20 points): Buzzer
Write a C program that controls the buzzer on the EasyWeb2 development board. The buzzer
is controlled by P4.2 and P4.3 ports and it needs a square wave input of 4.0+/- 0.5 KHz on
both ports, but with opposite values, that is, when P4.2 is a logic one, P4.3 should be a logic
zero). The buzzer should repeat the sequence: 1 second off, 2 seconds on. Use TimerA to
generate square waves.
Assignment #3 (30 points): Serial communication (EasyWeb2 to PC)
Write a C program that accepts a character from the HyperTerminal and then echoes it twice to
the HyperTerminal. The main program is an infinite loop waiting for a new character (received
through an interrupt service routine); after a character is received it sends its value back to the
HyperTerminal twice, followed by a new line and a carriage return characters.
Note UART mode: Baud rate is 38400 bps, 8-bit characters
To set up the HyperTerminal do the following:
• Connecting using: COM1
• Bit per second: 38400
• Data bits: 8
• Parity: none
• Stop bits: 1
• Flow control: use Xon/Xoff
Assignment #4 (40 points): Serial communication (EasyWeb2 to EasyWeb2)
Connect two EasyWeb2 (Board#1 and Board#2) using a serial bidirectional link and null-
modem cable. Write a C program that will scan buttons (B1-B3), send a message to the other
board if a button is pressed, receive messages from the other board, and control the status
LED, Relay1 and Relay2 based on the messages received from the other board.
• If the yellow button (B1) is pressed (port P4.4), blink twice the status LED (port P2.1) on
the other board (frequency of 1 Hz).
• If the red button (B2) is pressed (port P4.5), toggle (if it is On, turn if Off, and vice versa)
Relay1 (port P1.5) on the other board.
• If the white button (B3) is pressed (port P4.6), toggle Relay2 (port P1.6) on the other
board.
ECE, UAH Alex Milenkovich

Partial preview of the text

Download Lab Assignment 4 - Introduction to Embedded Computer Systems | CPE 323 and more Assignments Engineering in PDF only on Docsity!

CPE/EE 323: Laboratory Assignment 4

Purpose : To study MSP430 and learn how to utilize the Basic Clock Module, the TimerA, and the UART.

Assignment #1 (10 points): Blink the Status LED using TimerA Write a C program that toggles the status LED on the EasyWeb2 development board with frequency of 1Hz (approx. 1s is on, and 1s is off). Use the high frequency crystal for MCLK (8MHz) and ACLK (1MHz), and TimerA. Change parameters to increase toggle frequency to 2Hz and to decrease it to 0.5Hz.

Assignment #2 (20 points): Buzzer Write a C program that controls the buzzer on the EasyWeb2 development board. The buzzer is controlled by P4.2 and P4.3 ports and it needs a square wave input of 4.0+/- 0.5 KHz on both ports, but with opposite values, that is, when P4.2 is a logic one, P4.3 should be a logic zero). The buzzer should repeat the sequence: 1 second off, 2 seconds on. Use TimerA to generate square waves.

Assignment #3 (30 points): Serial communication (EasyWeb2 to PC) Write a C program that accepts a character from the HyperTerminal and then echoes it twice to the HyperTerminal. The main program is an infinite loop waiting for a new character (received through an interrupt service routine); after a character is received it sends its value back to the HyperTerminal twice, followed by a new line and a carriage return characters.

Note UART mode: Baud rate is 38400 bps, 8-bit characters

To set up the HyperTerminal do the following:

  • Connecting using: COM
  • Bit per second: 38400
  • Data bits: 8
  • Parity: none
  • Stop bits: 1
  • Flow control: use Xon/Xoff

Assignment #4 (40 points): Serial communication (EasyWeb2 to EasyWeb2) Connect two EasyWeb2 (Board#1 and Board#2) using a serial bidirectional link and null- modem cable. Write a C program that will scan buttons (B1-B3), send a message to the other board if a button is pressed, receive messages from the other board, and control the status LED, Relay1 and Relay2 based on the messages received from the other board.

  • If the yellow button (B1) is pressed (port P4.4), blink twice the status LED (port P2.1) on the other board (frequency of 1 Hz).
  • If the red button (B2) is pressed (port P4.5), toggle (if it is On, turn if Off, and vice versa) Relay1 (port P1.5) on the other board.
  • If the white button (B3) is pressed (port P4.6), toggle Relay2 (port P1.6) on the other board.

ECE, UAH Alex Milenkovich