Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(20 pts.) (10 pts.) Use timerA_1 in UP mode to generate a 120 Hz square wave on the TA1.2 (P7.6) pin using Toggle output mode.
- (20 pts.)
- (10 pts.) Use timerA_1 in UP mode to generate a 120 Hz square wave on the TA1.2 (P7.6) pin using Toggle output mode. Assume the system clock is at 48 MHz, and you are using SMCLK at 12 MHz for the timer clock. You will need to determine what value of prescale to use, and what value of TIMER_A1->CCR[0] and TIMER_A1->CCR[2] you need corresponding to that prescale value. Based on the values you calculate and the other specifications given above, write the code fragment needed to initialize timerA_1. Show your calculations.
prescale = _________
TIMER_A1->CCR[0] = ___________
TIMER_A1->CCR[2] = ___________
Code fragment to initialize TimerA_1:
- (10 pts.) Use timerA_2 in UP mode to generate a 60 Hz PWM signal on the TA2.3 (P6.6) pin. Assume the system clock is at 48 MHz, and you are using SMCLK at 12 MHz for the timer clock. Use a TOP value set by the TIMER_A2->CCR[0] register. Use reset/set mode on the output. Indicate what the minimum valid prescale value is. Based on that value, and the other specifications given above, write the code fragment needed to initialize timerA_2. Assume a duty cycle of 50 % initially to get the value for the TIMER_A2->CCR[3] register. Show your work.
prescale = ________________
TIMER_A2->CCR[3] = ________________
Code fragment to initialize TimerA_2:
code in c for msp432p401r
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started