Answered step by step
Verified Expert Solution
Question
1 Approved Answer
RA 1 button, what will happen? void main ( ) { unsigned short current _ duty, old _ duty, current _ duty 1 , old
RA button, what will happen?
void main
unsigned short currentduty, oldduty, currentduty oldduty;
PORTA ;
TRISA ; configure PORTA pins as input
PORTB ; set PORTB to
TRISB ; designate PORTB pins as output
PORTC ; set PORTC to
TRISC ; designate PORTC pins as output
PWMInit; Initialize PWM module at KHz
PWMInit; Initialize PWM module at KHz
currentduty ; initial value for currentduty
currentduty; initial value for currentduty
PWMStart; start PWM
PWMStart; start PWM
PWMSetDutycurrentduty; Set current duty for PWM
PWMSetDutycurrentduty; Set current duty for PWM
while endless loop
if RAObit button on RAO pressed
Delayms;
currentduty; increment currentduty
PWMSetDutycurrentduty;
if RAbit button on RA pressed
Delayms; decrement currentduty
PWMSetDutycurrentduty;
if RAbit button on RA pressed
Delayms;
currentduty; increment currentduty
PWMSetDutycurrentduty;
if RAbit button on RA pressed
Delayms;
currentduty; decrement currentduty
PWMSetDutycurrentduty;
Delayms; slow down change pace a little
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