Answered step by step
Verified Expert Solution
Question
1 Approved Answer
If Pressed RA 1 button, what will happen? void main 0 1 unsiened short current _ duty, ald _ duty, current _ duty 1 ,
If Pressed RA button, what will happen?
void main
unsiened short currentduty, aldduty, currentduty oldduty:
PORTA ;
TRISA ;
PORTB ;
TRISB ;
PORTC ;
TRISC ;
PWMInaSO:
PWMinit:
currentduly ;
currentduty;
PWMstari:
PWMstart:
PWMSetOutycurrentduty; Set current duty for PWM
PWMSetOutycurrentduty: Set curtent duty for PWM
while endless loop
if RAObit button on Rropressed
Delayms:
currentduty; increment currentduty
PWMSetOutycurrentduty:
If RAbit button on RA pressed
Delayms :
currentduty decrement currentduty
PWMSetDutycurientduty:
I
configure PORTA pins as input
set PORTO
devignate PORTB plins as output
set POATC
devienate PORTC plins as output
I initialize PWMI module at
Initialize PWM module at KHiz
Inlidal value for currentduty
I initial value for curtentduty
start PWM
Istar PWMa
increment currentduty
Ibution on RaI pressed
decrement currentduty
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