Archive for Code Examples

MSP430FR2433 Internal Oscillator

Configure MSP430FR2433 MCLK for 8 Mhz or 16 Mhz internal oscillator.

MSP430FR2433 – 8MHZ INTERNAL OSCILLATOR

MSP430FR2433 – 16MHZ INTERNAL OSCILLATOR

MSP430FR2433 – ROUTE CLOCK TO PORT PINS

 

8 MHZ INTERNAL OSCILLATOR

 

16 MHZ INTERNAL OSCILLATOR

 

end post

MSP430FR2433 External Oscillator

This code block can be used to add an external clock oscillator to the MSP430FR2433 Launchpad. The code should be located at the top of the MAIN function. Note that it is not necessary to set the direction of P2.0 (xout) and P2.1 (xin) as the input/output direction is automatically set with P2SEL0 and P2SEL1.

An oscilloscope can be used to check clock output on P1.3.

Crystal Oscillator

 

MSP430FR2433 LAUNCHPAD EXTERNAL OSCILLATOR CODE

MSP430FR2433 LAUNCHPAD CLOCK OUTPUT TO PORT PINS CODE

 

MSP430FR2433 LAUNCHPAD WITH EXTERNAL OSCILLATOR

 

end post

MSP430G Servo Tester Program

This program can be used with a Texas Instruments MSP-EXP430G2 Launchpad to create an encoder adjustable servo output that ranges from 1.0 ms to 2.5 ms and can be used to test hobby servos. The servo output is on port pin P1.2 and is adjustable in 0.020 ms (20 us) increments. Port pin P1.5 goes high when the servo output is at 1.5 ms. This allows an LED indicator to be connected as a visual aid.

Encoder connections are similar to this: Encoder Connections.

MAIN PROGRAM

PROGRAM INTERRUPTS

OUTPUT WAVEFORMS

1.0 ms SERVO WAVEFORM

 

1.5 ms SERVO WAVEFORM

 

2.5 ms SERVO WAVEFORM

 

SERVO TESTER

 

SERVO TESTER

 

//end post

MSP430 LED Voltage Display Code

M430G2553 code to create a DC voltmeter with a three digit multiplexed LED display. The voltage range is dependent on the input voltage divider.

MAIN FUNCTION CODE  

INTERRUPT AND DELAY FUNCTION

VOLTAGE DISPLAY SCHEMATIC

End Post

MSP430 OLED Display Code

Program examples for the the Newhaven NHD-0216KZW-AG5 OLED display.

FUNCTION TO INITIALIZE OLED DISPLAY

FUNCTION TO SEND A SINGLE ASCII CHARACTER

FUNCTION TO SEND A CHARACTER STRING

FUNCTION TO CREATE A 10 BIT BIT-BANGED SPI

 

The entire program code for the PWM display will be published in a separate post.

End Post