Subversion Repositories Code-Repo

Rev

Rev 107 | Rev 111 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 107 Rev 109
Line 25... Line 25...
25
}
25
}
26
 
26
 
27
void port_b_int_init() {
27
void port_b_int_init() {
28
    port_b_prev_state = 0x0F;
28
    port_b_prev_state = 0x0F;
29
 
29
 
30
    // Turn on internal pull-up for all port B pins
-
 
31
    INTCON2bits.RBPU = 0;;
30
    INTCON2bits.RBPU = 0;
32
 
31
    
33
    // Set pins as inputs
32
    // Set pins as inputs
34
    TRISBbits.TRISB4 = 1;
33
    TRISBbits.TRISB4 = 1;
35
    TRISBbits.TRISB5 = 1;
34
    TRISBbits.TRISB5 = 1;
36
    TRISBbits.TRISB6 = 1;
35
    TRISBbits.TRISB6 = 1;
37
    TRISBbits.TRISB7 = 1;
36
    TRISBbits.TRISB7 = 1;
38
 
37
 
-
 
38
    // Turn on internal voltage pull-up
-
 
39
    PORTBbits.RB4 = 1;
-
 
40
    PORTBbits.RB5 = 1;
-
 
41
    PORTBbits.RB6 = 1;
-
 
42
    PORTBbits.RB7 = 1;
39
    LATBbits.LATB4 = 0;
43
    LATBbits.LATB4 = 1;
40
    LATBbits.LATB5 = 0;
44
    LATBbits.LATB5 = 1;
41
    LATBbits.LATB6 = 0;
45
    LATBbits.LATB6 = 1;
42
    LATBbits.LATB7 = 0;
46
    LATBbits.LATB7 = 1;
43
 
47
 
44
    // Enable Port B interrupt
48
    // Enable Port B interrupt
45
    INTCONbits.RBIE = 1;
49
    INTCONbits.RBIE = 1;
46
}
50
}
47
 
51