Hi all.
I am trying to use 'setint' triggered by a Hall effect switch, and 'irin' in the same program.
Each individual part of the program works on it's own, but when I put the two together only 'irin' works!
Can these two be made to work together, will 'irin' allow anything else to run at the same time as it?
Thanks in anticipation.
I am trying to use 'setint' triggered by a Hall effect switch, and 'irin' in the same program.
Each individual part of the program works on it's own, but when I put the two together only 'irin' works!
Can these two be made to work together, will 'irin' allow anything else to run at the same time as it?
Thanks in anticipation.
Code:
#picaxe 40X2
#no_data
#no_table
setfreq em16 ' This line sets th clock speed to 16 MHz.
' A 16MHz resonator needs to be connected to pins 13 & 14.
let dirsA = %11111111 ' Set port A as all outputs.
let dirsB = %11111111 ' Set port B as all outputs.
let dirsC = %11111001
let dirsD = %11111111 ' Set port D as all outputs.
' This is the program for the 40X2 to read a decoded infrared signal on pin
' C.0 and place it in variable infravalue.
high c.1 ' Pin 16 colour 1
high c.5 ' Pin 24 colour 2
SYMBOL infravalue = b10 ; define an infra variable
let outpinsA = %11111111
let outpinsB = %11111111
let outpinsD = %11111111
setint %0000000,%00000100,C
start:
let outpinsB = %11111111
let outpinsD = %11111111
irin C.0, infravalue ; read input C.0 into infravalue
If infravalue =10 then
let outpinsB = %00000000
pause 1000
let outpinsB = %11111111
end if
If infravalue =20 then
let outpinsD = %00000000
pause 1000
let outpinsD = %11111111
pause 1000
end if
goto start
interrupt: ' This is the routine triggered by the Hall effect on C.2
let outpinsA = %00000000
pause 1000
let outpinsA = %11111111
setint %00000000,%00000100,C
return