Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 107 → Rev 109

/Classwork/ECE4534 - Embedded Systems/PIC 27J13/pin_interrupts.c
27,9 → 27,8
void port_b_int_init() {
port_b_prev_state = 0x0F;
 
// Turn on internal pull-up for all port B pins
INTCON2bits.RBPU = 0;;
 
INTCON2bits.RBPU = 0;
// Set pins as inputs
TRISBbits.TRISB4 = 1;
TRISBbits.TRISB5 = 1;
36,10 → 35,15
TRISBbits.TRISB6 = 1;
TRISBbits.TRISB7 = 1;
 
LATBbits.LATB4 = 0;
LATBbits.LATB5 = 0;
LATBbits.LATB6 = 0;
LATBbits.LATB7 = 0;
// Turn on internal voltage pull-up
PORTBbits.RB4 = 1;
PORTBbits.RB5 = 1;
PORTBbits.RB6 = 1;
PORTBbits.RB7 = 1;
LATBbits.LATB4 = 1;
LATBbits.LATB5 = 1;
LATBbits.LATB6 = 1;
LATBbits.LATB7 = 1;
 
// Enable Port B interrupt
INTCONbits.RBIE = 1;