Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

If Pressed RA 1 button, what will happen? void main 0 1 unsiened short current _ duty, ald _ duty, current _ duty 1 ,

If Pressed RA1 button, what will happen?
void main01
unsiened short current_duty, ald_duty, current_duty1, old_duty1:
PORTA =255;
TRISA =255;
PORTB =0;
TRISB =0;
PORTC =0;
TRISC =0;
PWM1_Ina(SO00):
PWM2_init(5000):
current_duly =16;
current_duty1=16;
PWM1_stari0:
PWM2_start1):
PWM1_Set_Outy(current_duty); // Set current duty for PWM1
PWM12_Set_Outy(current_duty1): //Set curtent duty for PWM2
while (1))// endless loop
if (RAO_bit))// button on Rropressed
Delay_ms(40):
current_duty+4; // increment current_duty
PWM1_Set_Outy(current_duty):
If (RA1_bit)(// button on RA1 pressed
Delay_ms (40) :
current_duty ,?? decrement current_duty
PWM1_Set_Duty(curient_duty):
I
// configure PORTA pins as input
// set PORTO 100
// devignate PORTB plins as output
// set POATC 100
// devienate PORTC plins as output
I/ initialize PWMI module at 5KHz
// Initialize PWM2 module at 5KHiz
// Inlidal value for current_duty
I/ initial value for curtent_duty 1
// start PWM1
I/star PWMa
// increment current_duty
I/bution on RaI pressed
//decrement current_duty
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