Microprocessor Project Required Coding
Dynamic 7- Segment Displays
Introduction
The main process of this lab is to display a combination of letters and digits with a delay of 0.5 seconds between 5, E, and A by writing a code to program the microcontroller. Then reducing the delay time to notice the difference.
Procedure
The instruction of this lab asked us to display three different characters on any three of the six 7-segment displays. This lab was very similar to our previous lab so we began with the information we already knew. Our three charters were 5,E, and A which we already knew the hexadecimal conversion. That took care of what to display, now we had to find hexadecimal numbers for which display to use. After turning the 6 displays into a 8-bit number we found the correct which to display conversion. Once we knew what and which to display we then used the knowledge discovered from the previous lab to write the code. Once the constant lines were set we entered our while loop. We needed to display 3 different outputs so we wrote the what to display and the which to display then delayed for 0.5 seconds then moved on to the next display. Once this was completed three times the while loop kept the process running allowing a sea of charters to constantly flow.
|
What to display |
Which to display |
|
|
5 |
0X6D |
FB |
|
E |
0X79 |
FD |
|
A |
0X77 |
FE |
#include <msp430.h>
int main(void)
{
P7DIR |=0xFF;// to set the direction
P8DIR |=0xFF;// to set the direction
WDTCTL = WDTPW + WDTHOLD; // stop watchdog timer
while(1)
{
P8OUT=0X6D;//what to display
P7OUT|=0x04;//High P7.2 output
P7OUT &=~0x04;//P7.2 output low
P8OUT=0xFB; // Which to display
P7OUT |= 0x08; //High
P7OUT &=~0x08;//low
_delay_cycles(50000);
P8OUT=0X79;//what to display
P7OUT|=0x04;//High P7.2 output
P7OUT &=~0x04;//P7.2 output low
P8OUT=0xFD; // Which to display
P7OUT |= 0x08; //High
P7OUT &=~0x08;//low
_delay_cycles(50000);
P8OUT=0X77;//what to display
P7OUT|=0x04;//High P7.2 output
P7OUT &=~0x04;//P7.2 output low
P8OUT=0xFE; // Which to display
P7OUT |= 0x08; //High
P7OUT &=~0x08;//low
_delay_cycles(50000);
}
return 0;
}
Results and Conclusions
We had a difficult time figuring out how to write the code and we noticed that we did not use the latch between each display. However, when we reduced the time interval between the displays, it changed so slowly. It all appeared to be displayed at the same time.
References
Lab 6 Dynamic 7-Segment Displays Manual
“MSP430F5438A” data sheet
Lab 5 Static 7-Segment Displays