Question: If Pressed RA 3 button, what will happen? void main ( ) f unsigned short current _ duty, old _ duty, current _ duty 1

If Pressed RA3 button, what will happen?
void main() f
unsigned short current_duty, old_duty, current_duty1, old_duty1;
PORTA =255;
TRISA =255;
PORTB =0;
TRISB =0;
PORTC =0;
TRISC =0;
PWM1_Init(5000);
PWM2_Init(5000);
current_duty =16;
current_duty 1=16;
PWM1_Start():
PWM2_start();
PWM1_Set_Duty(current_duty):
PWM2_Set_Duty(current_duty1);
while (1) I
if (RAO_bit)(
Delay_ms(40);
current_duty++;
PWM1_Set_Duty(current_duty):
I
if (RA1_bit){
Delay_ms(40);
current_duty - ; // decrement current_duty
PWM1_Set_Duty(current_duty):
I
if (RA2_bit)1
Delay_ms(40);
current_duty1++; // increment current_duty1
PWM2_Set_Duty(current_duty1);
l
if (RA3_bit)1
Delay_ms(40);
current_duty1-,?? decrement current_duty1
PWM2_Set_Duty(current_duty1);
I
Delay_ms(5):
H
// configure PORTA pins as input
??? set PORTB to 0
// designate PORTB pins as output
// set PORTC to 0
// designate PORTC pins as output
// Initialize PWM1 module at 5KHz
// Initialize PWM2 module at 5KHz
// initial value for current_duty
// initial value for current_duty1
// start PWM1
// start PWM2
// endless loop
// button on RAO pressed
// button on RA1 pressed
set current duty for PWM1
hiset current duty for PWM2
// button on RA2 pressed
f (RA2_bit)1// button on Delay_ms(40); current_duty1++; // incre PWM2_Set_Duty(current_duty1);
// button on RA3 pressed
Delay_ms(5): // slow down change pace a little
// slow down change pace a little
 If Pressed RA3 button, what will happen? void main() f unsigned

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!