Interfacing 7 Segment LED Display with MSP430 Launchpad
In this tutorial we will learn to interface a 7 segment LED display (LT543) with MSP430 Launchpad development board from Texas Instruments.A 7 Segment LED dispaly can be used to display a limited number of character sets like numbers(0-9),Hexadecimal characters (0-F) and a few english characters(H,L,E etc) but being a LED segment it can be easily read in the dark and is used widely on instrument panels and industrial displays.
All the C soure files along with datasheets and ciruit diagram used in this tutorial can be downloaded from our GitHub Page.
The code is written in embedded C and compiled using IAR Embedded Workbench.If you are new to Github Check this article to download code .
Circuit Diagram for interfacing 7 segment LED Display with MSP430 Launchpad can be found here.
7 Segment LED driver Circuit
To interface the 7 segment to the MSP430 launchpad ,we are going to build a small interfacing circut using 74LS244 octal buffer chip.LED's tend to draw a lot of current so to be on the safer side i am putting a buffer between the MSP430G2553 pins and the 7 Segment LED pins.The circuit diagram of the interfacing circuit is shown below.The PDF version of the circuit can be downloaded from here.
The 7 Segment LED display i am using here is LT543 which is a common cathode LED display (negative terminal of all the LED segments in the display are made common,Pins 3 and 8) .The pin diagram and the segments of the LT543 are shown below. Here pin numbers 3 and 8 are the common cathode and has to be tied to ground.
The pin numbers are shown in black and the LED segments associated with it are shown in red
The Octal buffer 74LS244 runs on 5V which you can take it from the USB section of the launchpad board as shown in the figure below.
Here i am using Port 1 of MSP430G2553 to interface with 7 Segment display.
P1.0 is connected to segment a of the LED display,P1.1 to segment b,............and P1.7 to segment dp.
Segment a is available at Pin Number 1 of connector P2 (data),Segment b at Pin Number 2 and so on.
Controlling the LED Segments
The individual segments of the display can be controlled easily by making the corresponding bits high.
For example to switch on the 'segment a' ,make P1.0 high and the rest of the pins low (0x01).
To switch on 'segment b' , make P1.1 high rest low (0x02).You can find the complete list in "7-segment-interfacing.c" in the code file download.
P1DIR = 0xFF;
P1OUT = 0x01; // Segment a ON
P1OUT = 0x02; // Segment b ON
P1OUT = 0x04; // Segment c ON
To create characters you can combine the codes for the individual segments (OR-ing them).For example to create the character 1, you can activate the segments b and c using the following code.
// to create 1
P1DIR = 0xFF;
P1OUT = 0x02 + 0x04; //segment b +segment c
or you can use
P1OUT = 0x06; //to draw 1
Here is a short video of 7 segment LED's displaying characters from 0 -F.