Hi guys
I need to re-map UART3 to RE0 and RE1, the pic is 18f65k40. In simulator, I don't see the value of PPSLOCK change at all, what I have done wrong?
here is how I tried to do it:
Here is the datasheet example (page337, section 17.4):
I need to re-map UART3 to RE0 and RE1, the pic is 18f65k40. In simulator, I don't see the value of PPSLOCK change at all, what I have done wrong?
here is how I tried to do it:
Code:
di();
// unlock peripheral pin select module (PPS)
// interrupt need to be disable if interrupt is enable before this point
PPSLOCK = 0x55;
PPSLOCK = 0xAA;
PPSLOCKbits.PPSLOCKED = 0;
// mapping UART3 TX and RX
RX3PPS = 0x21; // UART3 RX map to RE1
RE0PPS = 0x10; // UART3 TX map to RE0
// lock peripheral pin select module (PPS)
PPSLOCK = 0x55;
PPSLOCK = 0xAA;
PPSLOCKbits.PPSLOCKED = 1;
Code:
; Disable interrupts:
BCF INTCON,GIE
; Bank to PPSLOCK register
BANKSEL PPSLOCK
MOVLW 55h
; Required sequence, next 4 instructions
MOVWF PPSLOCK
MOVLW AAh
MOVWF PPSLOCK
; Clear PPSLOCKED bit to enable writes
; Only a BCF instruction will work
BCF PPSLOCK,PPSLOCKED
; Enable Interrupts
BSF INTCON,GIE