Microprocessor Project Required Coding

profilealahmadhu7
Static7-SegmentDisplays1.docx

Static 7-Segment Displays

Introduction:

In this lab, TI MSP430 microcontroller has been programmed to display 0~9 digits on the multiple 7 displays. Also, the microprocessor is programmed to display A~F letters with a 0.5s delay between each digit and letter.

Software Design:

#include <msp430.h>

char array[]= {0X3F,0X06,0X5D,0X4F,0X66,0X6B,0X7B,0X07,0X7F,0X67,0X77,0X7A, 0X39,0X5E,0X79,0X71}; // Converting the numbers and letters to hexadecimal

int i;

int main(void)

{

P7DIR |=0xFF; // to set the direction

P8DIR |=0xFF; // to set the direction

WDTCTL = WDTPW + WDTHOLD; // stop watchdog timer

while(1)

{

for(i=0; i<=15; i++) // it will start from the first value

{

P8OUT=array[i]; //what to display

P7OUT|=0x04; //High P7.2 output

P7OUT &=~0x04; //P7.2 output low

P8OUT=0x00; // Which to display

P7OUT|= 0x08; //High P7OUT&=~0x08; //Low

_delay_cycles(500000);

}

}

return 0;

}

Procedure:

To begin this project we worked on writing the code. We knew we needed to include an array. Inside this array we needed to convert all of the desired display combinations into hexadecimal numbers.Those conversions are shown below. The desired display will flash from 0 - 9 then A - F. We display these values through a seven segment display. We then set our values and outputs and entered our while loop to keep our code running. Inside the while loop we set a delay so the continuous cycle would delay for 0.5 seconds before displaying the next value.

A - Z and 0 - 9 hexadecimal conversions

A

b

C

d

E

F

0

1

0X77

0X7A

0X39

0X5E

0X79

0X71

0X3F

0X06

2

3

4

5

6

7

8

9

0X5D

0X6F

0X66

0X6B

0X7B

0X07

0X7F

0X67

Result and Conclusion:

Finally we debugged and successfully ran our code. When it began we saw that it displayed our desired value in the correct time intervals but not the desired charter. For that we had to go through and ensure that our hexadecimal numbers were correct. If the numbers were slightly off that could leave you with an E that looks like a C. Once our numbers were checked and corrected we ran it again to display the entire loop. This lab allowed us to test our knowledge in hexadecimal numbers and allowed us a first hand example in using multiple 7 segment displays.