675
void main() { // Configure I/O pins TRISB0 = 0; // Set RB0 as output for current sourcing (LED1) TRISB3 = 0; // Set RB3 as output for current sinking (LED2) TRISB1 = 1; // Set RB1 as input with pull-up resistor TRISB2 = 1; // Set RB2 as input with pull-down resistor // Initialize outputs RB0 = 0; // Ensure LED1 is off initially RB3 = 1; // Ensure LED2 is off initially (active low configuration) // Main program loop while (1) { // Check state of RB1 (pull-up configuration) if (RB1 == 0) { RB0 = 1; // Turn on LED1 (current sourcing) } else { RB0 = 0; // Turn off LED1 } // Check state of RB2 (pull-down configuration) if (RB2 == 1) { RB3 = 0; // Turn on LED2 (current sinking) } else { RB3 = 1; // Turn off LED2 } } }