tylerdurden
New Member
ok...
im going crazy with this issue.
i have a pic16f84 with a 4x3 keypad and an lcd conected to it. and i also made a kind of "alarm" program which stores 4 numbers in the memory. the program works perfect. it gets the key pressed and displays them on the lcd. but now i have to add a clock which is incremented by the tmr0 interrupt. by adding this to my program
the program still works OK!!! but when i add more nops or simply I take out the coments to make the interrupt actually DO something the program behaves different. by different i mean, I get to see al the predefined messages on the lcd but where it is suposed to show the values stored in the eeprom or the values entered in the keypad I get strange (or just random) characters.
e.g. "password ((((" ---> intead of "password 9999"
i tried saving almost every register which might be changed during the interrupt but that doesnt seem to be the problem since using the interrrupt with more nops also produces the "funny" behaviour.
please I really need help, i searched all over the net and cant find any solution. I dont want to mess up all my code doing stupid things...
i would be very gratefull if someone could give me a clue.
Fernando Aramendi
Ps1: let me know if you need more data
Ps2:Happy new year!!!
im going crazy with this issue.
i have a pic16f84 with a 4x3 keypad and an lcd conected to it. and i also made a kind of "alarm" program which stores 4 numbers in the memory. the program works perfect. it gets the key pressed and displays them on the lcd. but now i have to add a clock which is incremented by the tmr0 interrupt. by adding this to my program
Code:
bsf _rp0
movlw b'10000101' ; Prescaler e 1:64
movwf opcion
bcf _rp0
movlw b'10100000' ; Habilito int por TMR0
movwf intcon
clrf tmr0
clrf msec
clrf sec
Code:
int_reloj
movwf saveW ;save context
swapf saveW, f
swapf status, w
movwf saveS
nop
nop
nop
;ISR_Code bcf _rp0
; clrf tmr0
; incf msec,f
; bsf timef,msf
; movf msec,w
; sublw .100 ; 100 msec?
; btfss _z
; goto pop
; clrf msec
; bsf timef,sf
; incf sec,f
; bsf _rp0
; bcf porta,3
; bcf _rp0
; btfss porta,3
; goto prendo_led
; goto apago_led
;prendo_led bsf porta,3 ; led on
; goto pop
;apago_led bcf porta,3 ; led off
; goto pop
pop
bcf _t0if ;clear timer overflow
swapf saveS, w
movwf status
swapf saveW, w
retfie
the program still works OK!!! but when i add more nops or simply I take out the coments to make the interrupt actually DO something the program behaves different. by different i mean, I get to see al the predefined messages on the lcd but where it is suposed to show the values stored in the eeprom or the values entered in the keypad I get strange (or just random) characters.
e.g. "password ((((" ---> intead of "password 9999"
i tried saving almost every register which might be changed during the interrupt but that doesnt seem to be the problem since using the interrrupt with more nops also produces the "funny" behaviour.
please I really need help, i searched all over the net and cant find any solution. I dont want to mess up all my code doing stupid things...
i would be very gratefull if someone could give me a clue.
Fernando Aramendi
Ps1: let me know if you need more data
Ps2:Happy new year!!!