The Demo Program
The F5132EX board is factory programmed with a simple demo program. To use the demo: leave
the jumpers in their factory setting, connect the board to a PC serial port using the cable included, start
up a terminal program on the PC (Hyperterm or Tera Term, for example) set the port for 9600 bps, 1 stop,
no parity, HW control off. Connect the F5132EX to a DC power supply or battery using connector W1.
You will see the banner on the PC:
***********************************
* EA Electronics *
* MSP430F5132 Demo Program V1.0 *
***********************************
If you type a line in lower case on the terminal program, the demo program echoes back the line
in upper case after you hit the enter key. So if you type:
now hear this.
Followed by the enter key, the program echoes back :
NOW HEAR THIS.
The program also configures all port pins (except P1.1 & P1.2) as outputs and toggles them twice
a second.
Demo Source Code
#include <msp430.h>
#include <stdio.h>
#include <ctype.h>
void initPortPins(void);
void send_msg( char * buf, int len );
char startup1[] = {"\n***********************************\n\r"};
char startup2[] = {"\n* EA Electronics *\n\r"};
char startup3[] = {"\n* MSP430F5132 Demo Program V1.0 *\n\r"};
char startup4[] = {"\n***********************************\n\r"};
char newline[] = {"\n\r"};
#define END_OF_BUFFER
50
void initPortPins(void);
void send_msg( char * buf, int len );
void serial_echo( void );
/*
* main.c
* Serial port echo and toggle IO pins
*/
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
unsigned int j;
initPortPins();
// set up Serial port for 9600, 1 stop, no parity
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32kHz/9600
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRF_0; // Modulation UCBRSx=3, UCBRFx=0
UCA0CTL1 &= ~UCSWRST; // release USCI for operation
F5132EX User’s Guide Rev. 1.1 – Apr./2016
Page
6