@Ioannis
I have the following code below that works when sending to the SerialComm...
Code:
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Hserin with Darryl Taylor's Instant Interrupts
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
asm
__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
;__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_2_2L & _VREGEN_ON_2L
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
endasm
DEFINE OSC 48
DEFINE HSER_RCSTA 90h ' enable serial port,
DEFINE HSER_TXSTA 20h ' enable transmit,
DEFINE HSER_BAUD 9600
DEFINE HSER_CLOERR 1 ' automatic clear overrun error
TRISC = %10000000 ' PORTC.7 is the RX input, PORTC.6 is the TX output
' Serial communication definition
' ===============================
'
ADCON1 = %00001111 'Set up ADCON1 register no matter what you're doing!!!!!!
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
INCLUDE "MODEDEFS.BAS" ' Include Shiftin/out modes
INCLUDE "DT_INTS-18.bas" ' Base Interrupt System
INCLUDE "ReEnterPBP-18.bas" ' Include if using PBP interrupts
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
' Variable definition
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PortB = %00000000
TRISB = %00000000
RCIF VAR PIR1.5 ' Receive interrupt flag (1=full , 0=empty)
TXIF VAR PIR1.4 ' Transmit interrupt flag (1=empty, 0=full)
led var PORTC.0
led1 var PORTC.1
holdoff var word
SerialData var byte
SerialInput var byte[50]
PortB = 0
c var byte
i var byte
c = 0
clear
'((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RX_INT, _Getbytes, PBP, no
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE RX_INT ; enable RX_INT interrupts
'((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
' Subroutine to slow loop down some and toggle heartbeat
'((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
Mainloop:
c = 0
for holdoff = 1 to 100
pause 1
next holdoff
toggle led 'toggle led every loop for heartbeat
goto Mainloop
'((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
'ISR for RX_int interrupt
'((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))
Getbytes:
While RCIF = 1 ' clear the buffer
c = c + 1
'HSEROUT ["Process "]
HSERIN 100,error,[Serialdata] ' take it
HSEROUT [Serialdata] ' take it out
SerialInput[c] = Serialdata
select case Serialdata ' What to do with that data???
case "^" ' User selection = 1
HSEROUT ["Goto Sub Process "] ' take it out
gosub displaydata
End select
Wend
toggle led 'led to confirm program went to RX ISR
@ INT_RETURN
error:
Toggle led1
@ INT_RETURN
end
displaydata:
for i = 1 to c
Hserout [SerialInput[i]]
next i
return
Then I tried to insert GSM related one block of code at a time but the same result (triggers interrupt only once--upon bootup)..
>>>tacbanon
Bookmarks