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 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
PWMInit; Initialize PWM module at
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;
l
if RAbit button on RA pressed
Delayms;
currentduty; decrement currentduty
PWMSetDutycurrentduty;
Delayms; slow down change pace a little
Yantnz:
Increases the brightness of LED which connected to RC pin
Increases the brightness of LED which connected to RC pin
Decreases the brightness of LED which connected to RC pin
Decreases the brightness of LED which connected to RC pin
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
