New to interrupts, help please

jmumby

Senior Member
Hi there,

Haven't played with interrupts before so this might be a pretty obvious mistake. I have a cell phone that has a built in AT modem that has coms over RS232. Attached to a 20X2 it sends notifications of sms messages to the picaxe.

It then sends the message to a 4D OLED.

Heres my code

Code:
SEROUT 0, T2400, ($55)			; AUTOBAUD FOR 4D
PAUSE 10

SEROUT 0, T2400, ($45)  		; CLEAR SCREEN
PAUSE 10	

HSERSETUP B2400_16, %01			; SETUP H/W SERIAL FOR AUTO RECIEVE

SETINTFLAGS %00100000,%00100000	; SET INTERUPT FOR BACKGROUND RECIEVE

MAIN:
WAIT 10
GOTO MAIN 

INTERRUPT:
SEROUT 0, T2400, ($45)			; CLEAR SCREEN
WAIT 3					; WAIT FOR INPUT FROM PHONE
b1=0						; COUNTER
W3 = hserptr 				; INPUT COUNT
DO 						; PRINT TO SCREEN LOOP
	GET b1, b0
	SEROUT 0, T2400, ($54,b0, b1, $00, $FF, $FF)
	INC b1
	DEBUG
LOOP WHILE b1 < W3
PTR=0						; RESET POINTER START
SETINTFLAGS %00100000,%00100000	; RESET FLAGS
RETURN					; RETURN
This kind of works except once it gets one notification it just keeps repeating it. I thought the reset flags line would stop this. If I disconnect the phone it will just keep repeating what is in the scratchpad.

My theroy here is it will move the pointer to the start of the scratchpad and then reset the flag waiting for another message.

Thx
 
Last edited:

Svejk

Senior Member
I think you need to manually clear the flag:

hserinflag = 0

before you return from interrupt.
 
Top