Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Microprocessor class CCS assembly project Provide Copyable Code CONVERT THE GIVEN C CODE, INTO AN ASSEMBY PROJECT CODE. THE C CODE IS FROM THE FOLLOWING

Microprocessor class

CCS assembly project

Provide Copyable Code

CONVERT THE GIVEN C CODE, INTO AN ASSEMBY PROJECT CODE. THE C CODE IS FROM THE FOLLOWING QUESTION.

ONLY CONVERT THE C CODE TO AN ASSEMBLY CODE.

Write a C program for the MSP430 with the following specifications: When the push button (connected to P1.3 on the MSP430 LaunchPad) is pressed, the red LED (connected to P1.0 on the MSP430 LaunchPad) will turn on and wait for a certain time. Then, both the red and green LEDs (connected to P1.0 and P1.6 on the MSP430 LaunchPad) will turn on and wait for a certain time. Afterwards, the red LED (connected to P1.0 on the MSP430 LaunchPad) will turn off and the green LED (connected to P1.6) will turn on and wait for a certain time. Finally, both LEDs will turn off. This procedure is repeated indefinitely. Hint: Use loop operations to generate waiting times.

 CONVERT THE FOLLOWING C CODE, INTO AN ASSEMBLY PROJECT CODE: #include  #define LED_0 BIT0 #define LED_1 BIT6 #define LED_OUT P1OUT #define LED_DIR P1DIR #define BUTTON BIT3 unsigned int blink = 0; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer LED_DIR |= (LED_0 + LED_1); // Set P1.0 and P1.6 to output direction LED_OUT &= ~(LED_0 + LED_1); // Set the LEDs off P1REN |= BUTTON; //Enables a puller-Resistor on the button-pin P1OUT |= BUTTON; //Writes a "1" to the portpin, tellling the resistor to pullup P1IES |= BUTTON; //Triggers when you PRESS the button :: Pick one... //P1IES &= ~BUTTON; // Triggers when you RELEASE the button :: ...or pick the other P1IE |= BUTTON; //Enables the selector-mask for generating interrupts on the relevant pin __enable_interrupt(); // Interrupts get enabled *here* - they were disabled thus far.. for (;;) { if(blink > 0) { P1OUT ^= (LED_0 + LED_1); // Toggle P1.0 and P1.6 using exclusive-OR __delay_cycles(100000); // SW Delay of 10000 cycles at 1Mhz } } } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { blink ^= 0x01; P1IFG &= ~BUTTON; // P1.3 IFG cleared LED_OUT &= ~(LED_0 + LED_1); // Clear the LEDs so they start in OFF state } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

What is one of the skills required for independent learning?Explain

Answered: 1 week ago

Question

Know how procedures protect an organization

Answered: 1 week ago