In: Electrical Engineering
Write C18 program to get bit RB3 and send it to RC2.
 #include <p18f452.h>
 #include <stdio.h>
 #pragma config WDT = OFF
  
 void main(void)
 {
 int b0=0,b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0;  // Individual pin value variables.
 int c0=0,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0;
 
      TRISC = 0;  //PORT C = output configuration of port C.
      TRISB = 1;  //PORT B = input configuration of Port B.
 PORTB = 0x8;  // So RB3 bit is set on INPUT.
 b0 = PORTBbits.RB0;  // Each input bit is assigned a seperate variable
 b1 = PORTBbits.RB1;
 b2 = PORTBbits.RB2;
 b3 = PORTBbits.RB3;
 b4 = PORTBbits.RB4;
 b5 = PORTBbits.RB5;
 b6 = PORTBbits.RB6;
 b7 = PORTBbits.RB7;
     printf("\n INPUT %d,%d,%d,%d,%d,%d,%d,%d", b7,b6,b5,b4,b3,b2,b1,b0);
 PORTC= 59H; //so RC2 is set as output.
 c0 = PORTCbits.RC0;  // Each output bit is assigned a seperate variable.
 c1 = PORTCbits.RC1;
 c2 = PORTCbits.RC2;
 c3 = PORTCbits.RC3;
 c4 = PORTCbits.RC4;
 c5 = PORTCbits.RC5;
 c6 = PORTCbits.RC6;
 c7 = PORTCbits.RC7;
      printf("\n OUTPUTS %d,%d,%d,%d,%d,%d,%d,%d", c7,c6,c5,c4,c3,c2,c1,c0);
while (1); }