Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this project, you will build a display matrix of LED’s and a set of input bu

ID: 3819931 • Letter: F

Question

For this project, you will build a display matrix of LED’s and a set of input buttons to control the matrix. The matrix will consist of 24 LED’s arranged in a four row by six column pattern. The LED’s must be driven by a set of three 74LS377 IC’s arranged as a serial shift register. The shift register must be driven by an MSP430G2 Launchpad using only two IO pins. One and only one IO pin for the data bit and one and only one IO pin for the clock. The position of each bit in the display relative to the order that they are shifted out is up to the designer, but the matrix must visually be a four row by six column matrix of LED’s. All inputs must be properly de-bounced in software. The inputs must be created with the switches provided in the parts kit. No external pull-up/pull-down resistors may be used on the inputs. The internal MSP430 resistors must be used. **The P1.3 port may have an external resistor on your MPS430. If it does, you must use the external resistor as intended to produce the input. The user should be able to move a cursor through the matrix of LED’s and control the status of each individual LED. The current cursor should be indicated by a blinking LED. IO Pins: Inputs:

GPIO Up P1.1

Down P1.2

Left P2.0

Right P2.1

Toggle P2.2

Save P1.3** Outputs: Data Out P1.6 Clk Out P1.0 Movement:

Example :

The input should come from the MSP430 Data and Clock signals. Demonstrate an MSP430 software program that transmits data from the MSP430 to the LED’s of the shift register.

This code uses P1.0 for data and P1.6 for clock, the project uses the opposite. Therefore, P1.0 is the clock and P1.6 is Data. Modify the next program to make p1.0= clock and P1.6 is Data.

// Uses P1.6 as the clock to the external D-Flip-Flop
void ClockData(void)
{
   P1OUT |= LS377CLOCK;                           // Assert P1.6 (rising clock edge)
   __delay_cycles(1);                   // Delay
   P1OUT &= ~LS377CLOCK;                           // De-assert P1.6 (falling clock)
}
// Shift out the value of DataOut to the connected shift register
void SerialDataOut(char DataOut)
{
   char i, lsb;                           // i = for loop index
                                           // lsb = Value of the Least Significant Bit of DataOut
   for(i=0; i<=7; i++)
   {
       lsb = DataOut & 0x01;               // Set lsb to right most bit of DataOut
       // Place the LSB of DataOut on P1.0 and therefore to the input of the shift register
       if (lsb)
       {
           P1OUT |= 0x01;       // Assert P1.0 if the LSB of DataOut is 1
       }
       else
       {
           P1OUT &= ~0x01;       // De-assert P1.0 if the LSB of DataOut is 0
       }
       __delay_cycles(80000);               // Delay
       // Clock the Data to the Shift Register
       ClockData();
       // Shift data left and repeat the for loop
       DataOut >>= 0x01;
   }
}
/*
* main.c
*/

int main(void) {
   char Data;                       // Internal value that stores values
                                   // internal to the program and then
                                   // gets sent to shift register


   WDTCTL = WDTPW | WDTHOLD;       // Stop watchdog timer

   P1DIR |= MASKMSP430OUTS;       // Set P1.0 and P1.6 as outputs



   while(1) {

   Data = 0x00;                   // Clear Data

   SerialDataOut(Data);           // Shift Data out to LED's
   __delay_cycles(800000);               // Delay

   Data = 0x55;                       // Shift Out the value 0x55
   SerialDataOut(Data);
   __delay_cycles(800000);

   Data = 0xaa;                       // Shift Out the value 0xaa
   SerialDataOut(Data);
   __delay_cycles(800000);

   Data = 0x55;                       // Shift Out the value 0x55
   SerialDataOut(Data);
   __delay_cycles(800000);



   }
}

Explanation / Answer

void ClockData(void)
{
   P1OUT |= LS377CLOCK;                           // Assert P1.6 (rising clock edge)
   __delay_cycles(1);                   // Delay
   P1OUT &= ~LS377CLOCK;                           // De-assert P1.6 (falling clock)
}
// Shift out the value of DataOut to the connected shift register
void SerialDataOut(char DataOut)
{
   char i, lsb;                           // i = for loop index
                                           // lsb = Value of the Least Significant Bit of DataOut
   for(i=0; i<=7; i++)
   {
       lsb = DataOut & 0x01;               // Set lsb to right most bit of DataOut
       // Place the LSB of DataOut on P1.0 and therefore to the input of the shift register
       if (lsb)
       {
           P1OUT |= 0x01;       // Assert P1.0 if the LSB of DataOut is 1
       }
       else
       {
           P1OUT &= ~0x01;       // De-assert P1.0 if the LSB of DataOut is 0
       }
       __delay_cycles(80000);               // Delay
       // Clock the Data to the Shift Register
       ClockData();
       // Shift data left and repeat the for loop
       DataOut >>= 0x01;
   }
}
/*
* main.c
*/

int main(void) {
   char Data;                       // Internal value that stores values
                                   // internal to the program and then
                                   // gets sent to shift register


   WDTCTL = WDTPW | WDTHOLD;       // Stop watchdog timer

   P1DIR |= MASKMSP430OUTS;       // Set P1.0 and P1.6 as outputs



   while(1) {

   Data = 0x00;                   // Clear Data

   SerialDataOut(Data);           // Shift Data out to LED's
   __delay_cycles(800000);               // Delay

   Data = 0x55;                       // Shift Out the value 0x55
   SerialDataOut(Data);
   __delay_cycles(800000);

   Data = 0xaa;                       // Shift Out the value 0xaa
   SerialDataOut(Data);
   __delay_cycles(800000);

   Data = 0x55;                       // Shift Out the value 0x55
   SerialDataOut(Data);
   __delay_cycles(800000);



   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote