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

MODIFY CODE. READ ALL INSTRUCTIONS Modify your design of assignment #1 by feedin

ID: 2079301 • Letter: M

Question

MODIFY CODE. READ ALL INSTRUCTIONS

Modify your design of assignment #1 by feeding back the FA outputs into the MSP430. Modify your software to compare the actual FA outputs with the expected outputs. If actual and expected outputs differ, the program should stop to show the bad I/O combination and turn on an error indicator. The program should resume following the FA truth table once the difference in outputs disappears.

#include Kmsp430.h int main (void) WDTCTL WDTPW WDTHOLD Stop watchdog timer P1DIR 0x07 Set P1.0 to output direction for volatile unsigned int i,j; for (i-0 i

Explanation / Answer

#include <msp430.h>
int main(void) //main function starts
{
   WDTCTL=WDTPW+WDTHOLD;               //Stop watchdog timer
   P1DIR|=0x07;                       //Intializing P1.0=Cin,P1.1=B,P1.2=A as output pins
   P2DIR|=0x07;                       //Intializing P2.0=error led as output pins connect indicating led to this pin
   volatile int out[8]={0,1,1,2,1,2,2,3};           //desired output array for the given input


   for(;;)                               //loop runs for infinite time
   {
   volatile unsigned int i,j;           //i,j are variables for further loop iteration

       for(i=0;i<8;i++)               //loop repeats for 8 times from i=0 to 7
       {
           P1OUT=i;                   //assaigning i value to port P1OUT
           while(P6IN!=out[i])           //connect P6.0 to sum and P6.1 to Cout checking for correct opertion
           {
               P2OUT=1;               //if there is error led will on and program will be in this untill error rectified
           }
           P2OUT=0;                   //removing the signal to error led
           for(j=0;j<50000;j++)       //creates delay, can change the delay time by changing 50000 to other value accordingly
           {

           }
       }
   }
   return(0);                   //returns null value

}

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