I have been using the Rx interrupt with pic 16F88 several times without any problem since today.
The simple code below just go through ISR (Getbytes) only once after reset then no way to see the led_0 showup again, while Led_1 and Led_2 just work as they should.
Anybody sees where the error could possibly be?
Code:
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts
;-- Place a copy of these variables in your Main program -------------------
;-- The compiler will tell you which lines to un-comment --
;-- Do Not un-comment these lines --
;---------------------------------------------------------------------------
;wsave VAR BYTE $20 SYSTEM ' location for W if in bank0
wsave VAR BYTE $70 SYSTEM ' alternate save location for W
' if using $70, comment wsave1-3
' --- IF any of these three lines cause an error ?? ------------------------
' Comment them out to fix the problem ----
' -- Which variables are needed, depends on the Chip you are using --
wsave1 VAR BYTE $A0 SYSTEM ' location for W if in bank1
wsave2 VAR BYTE $120 SYSTEM ' location for W if in bank2
wsave3 VAR BYTE $1A0 SYSTEM ' location for W if in bank3
' --------------------------------------------------------------------------
'------------------------------------------------------------------------
ANSEL = 0
CMCON = 7
TrisA = 0
TrisB = %00000100
PortA = 0
DEFINE OSC 16
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
'DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_SPBRG 51 ' 4800 Baud @ 16MHz, 0,17%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
'------------------------------------------------------------------------
Led_0 var PortB.0
Led_1 var PortB.3
Led_2 var PortB.4
A0 var word
New_L var byte
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Getbytes, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
INT_ENABLE RX_INT ; enable RX_INT interrupts
ENDASM
Led_0 = 1
For A0 = 0 to 10
Led_2 = !Led_2
pause 500
Led_1 = !Led_1
next A0
PortB = 0
goto MainLoop
Getbytes:
Led_0 = !Led_0
@ Return
MainLoop:
Hserin 1,TOut,[New_L]
if New_L > 0 then Led_1 = !Led_1
TOut:
A0=A0+1
if A0 = 1000 then
Led_2 = !Led_2
A0 = 0
endif
goto MainLoop
end
Thank for the help.
Al.
Bookmarks