Question: I Pressea RAI button, what will nappen void main ( ) unsigned short current _ duty, old _ duty, current _ duty 1 , old

I Pressea RAI button, what will nappen
void main ()
unsigned short current_duty, old_duty, current_duty1, old_duty1;
PORTA =255;
TRISA =255; ,?? configure PORTA pins as input
PORTB =0;,?? set PORTB to 0
TRISB =0;,// designate PORTB pins as output
PORTC =0;,?? set PORTC to 0
TRISC =0; ,// designate PORTC pins as output
PWM1_Init(5000); ,?? Initialize PWM1 module at 5KHz
PWM2_Init(5000); // Initialize PWM2 module at 5KHz
current_duty =16; ,?? initial value for current_duty
current_duty 1=16;,?? initial value for current_duty1
PWM1_start0; ,?? start PWM1
PWM2_Start(); ,// start PWM2
PWM1_Set_Duty(current_duty); // Set current duty for PWM1
PWM2_Set_Duty(current_duty1); // set current duty for PWM2
while (1)1// endless loop
if (RAO_bit)/// button on RAO pressed
Delay_ms (40);
current_duty++; // increment current_duty
PWM1_Set_Duty(current_duty);
}
if (RA1_bit){// button on RA1 pressed
Delay_ms(40); ,// decrement current_duty
PWM1_Set_Duty(current_duty);
}
if (RA2_bit){// button on RA2 pressed
Delay_ms (40);
current_duty1+ ; // increment current_duty1
PWM2_Set_Duty(current_duty1);
l
if (RA3_bit){// button on RA3 pressed
Delay_ms(40);
current_duty1-; // decrement current_duty1
PWM2_Set_Duty(current_duty1);
}
Delay_ms(5); // slow down change pace a little
Yantnz:
Increases the brightness of LED which connected to RC1 pin
Increases the brightness of LED which connected to RC2 pin
Decreases the brightness of LED which connected to RC1 pin
Decreases the brightness of LED which connected to RC2 pin
 I Pressea RAI button, what will nappen void main () 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!