2 Attachment(s)
Interrupt Or I Am Going To Die
I have a problem with PORTB:4-7 interrupts ,I can actually get pic in to interrupt but can't get it out from interrupt to last process, here is my code below ; You can find schematics and ISIS simulation file which is processed in 6.9 in attachments.
PLEASE SOMEBODY HELP ,I AM BEGINING TO LOSE MY MIND!
device 16f84a
ON_INTERRUPT goto flash
intcon = %10001000
input portb.6 ' Bu pinleri sıfırladıktan sonra alıcı olarak ayarlamalısın
loop:
high porta
delayms 200
low porta
delayms 200
goto loop
disable
flash:
delayms 20
low porta
intcon.0 = 0
resume
enable
end
Finally working but still got a problem
Thanks alot for your helps and replies;
It finally works with this code below , but to return to main progress takes approximetly 1:20 minute. I think there might be problem with my schematic; If ISIS is that good, may be simulation thinks about small arcs that is created by button .Which gives a unexpected voltage levels for a short time to the PORTB.6.So PIC interrupts it's self for more then one time.The reason that took so long, might be that. Is this the problem or is it still in software _?
device 16f84a
ON_INTERRUPT goto flash
intcon = %10001000
input portb.6
loop:
high porta
delayms 200
low porta
delayms 200
goto loop
disable
flash:
delayms 1000
MOVF PORTB, W
low porta
intcon.0 = 0
CONTEXT RESTORE
end
For a simple click I get 2 change
After using this new code below, I get value of sayi +2 each time I click.
device 16f84a
ON_INTERRUPT goto flash
intcon = %10001000
input portb.6 ' Bu pinleri sıfırladıktan sonra alıcı olarak ayarlamalısın
dim sayi as byte
sayi = 0
loop:
high porta
delayms 200
serout portb.3,16780,[Dec sayi ,13]
goto loop
disable
flash:
MOVF PORTB, W
low porta
intcon.0 = 0
sayi = sayi + 1
CONTEXT RESTORE
end
Interrupt Or I Am Going To Die
DEFINE LOADER_USED 1
INCLUDE "modedefs.bas"
DEFINE HSER_BAUD 9600
DEFINE HSER_SPBRG 25 'Gebruik deze twee defines 25
dEFINE HSER_TXSTA 24h 'voor HSER met 9600 Baud
OPTION_REG = $7f ' Enable PORTB pullups
ADCON1 = 7 ' Make PORTA and PORTE digital
on interrupt goto myint
INTCON = $88
pause 50
TRISB = %11110000
led var portb.0
start:
pause 5
goto start
'***Start interruptroutine***
disable
myint:
high led
pause 500
low led
INTCON.0=0 'Clear interruptflag
resume
enable
end