Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 0 : 0 0 6 Ocak Cmt Back f Pressed RA 2 button, what will happen? void main ( ) ! unsigned shori current

20:006 Ocak Cmt
Back
f Pressed RA2 button, what will happen?
void main()!
unsigned shori 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_duty1=16;,?? initial value for current_duty1
PWM1_Start(); ,// 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)// endless loop
if (RAO_bit)}// button on RAO pressed
Delay_ms(40);
current_duty+4; // increment current_duty
PWM1_Set_Duty(current_duty);
l
if (RA1_bit)}// button on RA1 pressed
Delay_ms(40); ,// decrement current duty
PWM1_Set_Duty(current_duty):
l
if (RA2_bit)1// button on RA2 pressed
Delay_ms(40);
current_duty1+t; // increment current_duty1
PWM2_Set_Duty(current_duty1);
if (RA3_bit)1// button on RA3 pressed
Delay_ms(40):
current_duty1 ; // decrement current_duty1
Home
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

How were the HR functions affected by Hurricane Rita?

Answered: 1 week ago

Question

What information might lead you to choose working for the company?

Answered: 1 week ago

Question

Which environment factor(s) did Hurricane Rita affect? Discuss.

Answered: 1 week ago