Interupts

JonV

New Member
I have just tried using interupts for the first time today on an 18A,

I have copied the code from the user manual exactly for the setint command, but when i try to download it to the chip a empty messagebox with the title "Compile Error..." comes up and the process fails, this doesn't happen without the set int command,

for reference my code is:

Code:
setint 0,0

start:
	if b0 = 2 then ledtoggle
	if b0 = 1 then ledon
	if b0 = 0 then ledoff
	goto start

ledtoggle:
	toggle 0
	pause 100
goto start

ledon:
	high 0
goto start

ledoff:
	low 0
goto start


interupt:
	if pin0 = 0 then interupt
	serin 0,n2400,b0
return
The project should wait until the input0 is pulled low and released (pull up resistor) and then wait for a serial command on the line.

Any help on this message would be good

jon
 

cpedw

Senior Member
You also need a non-zero value for the 2nd parameter of the SETINT command. To use pin 0 going low to generate an interrupt, you need to set the MASK paramter to have bit 0 set:
SETINT %00000000, %00000001
which is the same as

SETINT 0,1

Derek
 
Top