Hi Kyle,
I found a compiler problem trying to turn ON the RTCC on PIC18F44j11. First
issue, the assembler instruction movlb is not implemented or not available
for the user?
The RTCC need the magic Microchip sequence for turning on RTCC or
writing/reading in the RTCC registers.
The sequence recommended by Microchip for this is:
movlb 15
movlw 0x55
movwf EECON2
movlw 0xAA
movwf EECON2
bsf RTCCFG_RTCWREN
I've written the stuff in jal:
EECON2 = 0x55 -- \ required sequence
EECON2 = 0xAA -- /
RTCCFG_RTCWREN = 1 ; allow writting to RTCCFG
which creates the following wrong code:
; 191 EECON2 = 0x55 -- \ required sequence
movlw 85
movwf v_eecon2,v__access
; 192 EECON2 = 0xAA -- /
movlw 170
movwf v_eecon2,v__access
; 193 RTCCFG_RTCWREN = 1 ; allow writting to RTCCFG
movlb 15
bsf v_rtccfg, 5,v__banked ;
rtccfg_rtcwren
The workaround to this is:
RTCCFG_RTCWREN = 1
EECON2 = 0x55 -- \ required sequence
EECON2 = 0xAA -- /
RTCCFG_RTCWREN = 1 ; allow writting to RTCCFG
which create the correct code:
; 190 RTCCFG_RTCWREN = 1
movlb 15
bsf v_rtccfg, 5,v__banked ;
rtccfg_rtcwren
; 191 EECON2 = 0x55 -- \ required sequence
movlw 85
movwf v_eecon2,v__access
; 192 EECON2 = 0xAA -- /
movlw 170
movwf v_eecon2,v__access
; 193 RTCCFG_RTCWREN = 1 ; allow writting to RTCCFG
bsf v_rtccfg, 5,v__banked ;
rtccfg_rtcwren
However, I'm afraid this error can appear anywhere on the program where bank
switching is required, right?
thx,
Vasile
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.