This problem is repeatable on the 18F14K22.
Writing a word value to the timer1 register fails. (timer1 is already stopped of course)
i.e, Timer1=777
Immediately reading back the timer1 register shows that it was not successfully written to the timer1 register.
From reading the ASM output file, it seems the wrong registers are being accessed on the 18F14K22.
A successful work around is TMR1L=temp:TMR1H=temp_H
Hopefully this information will save a lot of frustration....and maybe a fix could be made to the chipfile /compiler ?
The block of code below is lifted straight from the compilers ASM output file.
MAIN ;dim temp as word ;temp = 777
movlw 9 movwf TEMP,BANKED movlw 3 movwf TEMP_H,BANKED
;old way, not working on 18F1422 (but tested ok on an 18F26k22)
;timer1=temp rcall FN_TIMER1 movff TEMP,TIMER1 movff TEMP_H,TIMER1_H
;long way to write to timer1 (working on 14K22) ;tmr1H = temp_H movff TEMP_H,TMR1H ;tmr1L = temp movff TEMP,TMR1L
This a known issue. It is fixed.
What release/version of GCB are you using?
Anobium
Log in to post a comment.
This problem is repeatable on the 18F14K22.
Writing a word value to the timer1 register fails. (timer1 is already stopped of course)
i.e, Timer1=777
Immediately reading back the timer1 register shows that it was not successfully written to the timer1 register.
From reading the ASM output file, it seems the wrong registers are being accessed on the 18F14K22.
A successful work around is TMR1L=temp:TMR1H=temp_H
Hopefully this information will save a lot of frustration....and maybe a fix could be made to the chipfile /compiler ?
The block of code below is lifted straight from the compilers ASM output file.
MAIN
;dim temp as word
;temp = 777
;old way, not working on 18F1422 (but tested ok on an 18F26k22)
;timer1=temp
rcall FN_TIMER1
movff TEMP,TIMER1
movff TEMP_H,TIMER1_H
;long way to write to timer1 (working on 14K22)
;tmr1H = temp_H
movff TEMP_H,TMR1H
;tmr1L = temp
movff TEMP,TMR1L
This a known issue. It is fixed.
What release/version of GCB are you using?
Anobium