Andres Rodriguez
New Member
I am trying to create an interrupt when a pulsin command receives a value of less than 150 from an RC receiver.
When I run this code in the simulator, upon the execution of the instruction "if RXIN<150 then Let Land=1", OUTPUT PIN 2 takes the value 1 instead of INPUT PIN 2. Therefore, the interrupt never occurs. I am probably doing something wrong but I can't figure what that is. Any advice will be greatly appreciated.
The code is as follows.
When I run this code in the simulator, upon the execution of the instruction "if RXIN<150 then Let Land=1", OUTPUT PIN 2 takes the value 1 instead of INPUT PIN 2. Therefore, the interrupt never occurs. I am probably doing something wrong but I can't figure what that is. Any advice will be greatly appreciated.
The code is as follows.
Code:
#picaxe 28x1
#com 4
'Variables
Symbol RXIN =W0
Symbol Dly = b6
Symbol M=b4
Symbol N=b5
Symbol R=b7
Pause 5000
'Pins
Symbol Land = Input2
Symbol RX_IN= Input0
let dirsc = %11110010
let pinsc = %00000000
setint %00000100,%00000100
Main:
Dly=30
Pulsin 0,1,RXIN
if RXIN<150 then Let Land=1
endif
SHOW:
For R=0 to 5
FORWRD:'***********************************
............
..............
............
Pause 20
Goto Main
'********************************************************
Interrupt:
For R=0 to 5
let pinsc=%00010010
pause Dly
let pins=%00000000
M=%10000000
let pinsc=%00010000
for N=0 to 7
let pins=M
M=M/2
pause Dly
Next N
let pins=%00000000
pause DLY
let pinsc=%10010000
Pause Dly
let pinsc=%01010000
Pause Dly
let pinsc=%00110000
Pause Dly
let pinsc=%00010000
Pause Dly
Pause Dly
let pinsc=%00010000
pause Dly
let pinsc=%00010010
Next R
setint %00000100,%00000100
return