Short Answer Write C code to setup PORTB in the following configuration. Do not
ID: 3603370 • Letter: S
Question
Short Answer Write C code to setup PORTB in the following configuration. Do not write an entire C program, only write the lines required to perform the following configuration 1. PB7 through PB4 are inputs with internal pull up resistors enabled and -PB3 through PBO are outputs and set to logic high (5 Points) 2. low. Assume the PB3 has previously been configured as an input with pull-up resistor enabled. Write a while loop that executes and continues executing as long as PB3 is logic (5 Points)Explanation / Answer
1.
ANSEL = ANSELH = 0; // All the I/O pins are configured as digital
PORTB = 0; // Clear PORTB pins
TRISB = 0b11110000; // All the pins with 1 are input pins & with 0 are output pins
RBPU = 0; // Enable Pull-up resistors
PORTB.PB0 = 1; // Set output pins to logic high
PORTB.PB1 = 1;
PORTB.PB2 = 1;
PORTB.PB3 = 1;
2.
while(PORTB.PB3 == 0){}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.