servo260
- 20th December 2004, 00:22
Hi,
I'm trying to use asm interrupts in pbp but I have the following problem:
the interrupt works fine, but the main program works at "half" if that makes sense, it only run a part of the main program while doing the interrupt.
here is the simple code i'm using to test it:
define osc 20
clear
pulsos var word
x var word
num var byte
wsave var byte $20 system
ssave var byte bank0 system
psave var byte bank0 system
TRISA = %11111111 ; configura el puerto A como salida
TRISB = %10000000 ; configura los puertos B0-6 como salida
goto start ; salta al programa principal antes que la interrupcion
define INTHAND display ; indica cual es la interrupcion
start:
option_reg = %00000111
intcon = %10100000
main:
x = 123
pause 500
x = 321
pause 500
goto main
asm
display movwf wsave ; display rutine
swapf STATUS, W
clrf STATUS
movwf ssave
movf PCLATH, W
movwf psave
endasm
num = x dig 0
portb = num
high portb.4
pauseus 50
low portb.4
num = x dig 1
portb = num
high portb.5
pauseus 50
low portb.5
num = x dig 2
portb = num
high portb.6
pauseus 50
low portb.6
asm
bcf INTCON, 1
movf psave, W
movwf PCLATH
swapf ssave, W
movwf STATUS
swapf wsave, F
swapf wsave, W
retfie
endasm
the problem is I only get to see the 123.
If someone knows how to solve this please help me.
Thanks.
I'm trying to use asm interrupts in pbp but I have the following problem:
the interrupt works fine, but the main program works at "half" if that makes sense, it only run a part of the main program while doing the interrupt.
here is the simple code i'm using to test it:
define osc 20
clear
pulsos var word
x var word
num var byte
wsave var byte $20 system
ssave var byte bank0 system
psave var byte bank0 system
TRISA = %11111111 ; configura el puerto A como salida
TRISB = %10000000 ; configura los puertos B0-6 como salida
goto start ; salta al programa principal antes que la interrupcion
define INTHAND display ; indica cual es la interrupcion
start:
option_reg = %00000111
intcon = %10100000
main:
x = 123
pause 500
x = 321
pause 500
goto main
asm
display movwf wsave ; display rutine
swapf STATUS, W
clrf STATUS
movwf ssave
movf PCLATH, W
movwf psave
endasm
num = x dig 0
portb = num
high portb.4
pauseus 50
low portb.4
num = x dig 1
portb = num
high portb.5
pauseus 50
low portb.5
num = x dig 2
portb = num
high portb.6
pauseus 50
low portb.6
asm
bcf INTCON, 1
movf psave, W
movwf PCLATH
swapf ssave, W
movwf STATUS
swapf wsave, F
swapf wsave, W
retfie
endasm
the problem is I only get to see the 123.
If someone knows how to solve this please help me.
Thanks.