Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include msp.h /** * main.c */ void main(void){ WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // Stop WDT P5->DIR &=~ BIT1; P5->OUT &=~ BIT1; // Enable pull-down

#include "msp.h"

/** * main.c */ void main(void){ WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // Stop WDT

P5->DIR &=~ BIT1; P5->OUT &=~ BIT1; // Enable pull-down resistor (P1.1 output high) P5->SEL0 = 0; P5->SEL1 = 0; P5->IES = BIT1; // Interrupt on high-to-low transition P5->IFG = 0; // Clear all P1 interrupt flags P5->IE = BIT1; // Enable interrupt for P1.1 // Enable Port 2 interrupt on the NVIC NVIC->ISER[1] |= BIT7;

P5->DIR |= BIT0; // All set as outputs. P5->OUT &=~ BIT0; //turn off all LEDS

while(1){

}

}

void PORT5_IRQHandler(void) { P5->OUT |= BIT0; //turn off all LEDS

////Motor Setup "PWM" P2->DIR |= BIT7; // P2.4~5 set TA0.1~2 P2->SEL0 |= BIT7; P2->SEL1 &=~ BIT7; TIMER_A0->CCR[0] = 60000 - 1; // PWM Period TIMER_A0->CCTL[4] = TIMER_A_CCTLN_OUTMOD_7; // CCR1 reset/set TIMER_A0->CCR[4] = 7700; // CCR1 PWM duty cycle TIMER_A0->CTL = TIMER_A_CTL_SSEL__SMCLK | // SMCLK TIMER_A_CTL_MC__UP | // Up mode TIMER_A_CTL_CLR; // Clear TAR

}

Hi coders can you guys help me out I have to design a Port Interrupt PWM signal but everytime I run this code I am entering the port interrupt, I know so because of the light that turns on but it is only executing the light turning on but not the PWM, the PWM is also correct because I have run it in Main with an effect to the Motor, WHAT AM I DOING WRONG HERE?

I AM USING AN MSP432 AND CODING IN CODE COMPOSER

THANK YOU, WILL THUMB UP!

PLEASE NOTE NOT ALL THE COMMENTS ARE ACCURATE SINCE I AM JUST COPYING AND PASTING MOST EVERYTING.

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions