Parallel tasking between Start0 and Start1 is fine until the serin command is hit in "Start0" at that point Start1 also stops. I have attached a snip-it of my code below. To test my theory I added a Do statement (not included in the code below) at the being of my Start1 that would blink ledpir. the led would blink several times then just stay high. So I ran the code in the simulation software, where it appears that both Start0 and Start1 halt execution when Start0 hits the "serin" command. Of course Start0 should halt while waiting to receive a signal.
So will serin work with parallel tasking?
Thanks..
Edited - this all started when I could only get my code to receive RF signal "Start0". Start1 - a switch at this point, would not execute. both Start0 and Start1 run fine as a single application.
So will serin work with parallel tasking?
Thanks..
Edited - this all started when I could only get my code to receive RF signal "Start0". Start1 - a switch at this point, would not execute. both Start0 and Start1 run fine as a single application.
Code:
#picaxe 18m2 ;;
#Terminal 4800
symbol sw1 = pinC.1 ' Switch 1
symbol sw2 = pinC.0 ' Switch 2
symbol sw3 = pinC.7 ' Switch 3
symbol sw4 = pinC.6 ' Switch 4
symbol PIR = pinB.1 ; define pin C.1 as PIR input
symbol RF = pinB.2 ; define IR in pin
symbol LDR = pinB.3 ; define LDR pin
symbol light = B.4 ; define pin B.1 with the name "light"
symbol rec = B.5 ; define pin B.2 with the name "video"
symbol power = B.6 ; define pin B.3 with the name "power"
symbol ledpir= B.7 ; define pin B.0 with name "ledpir" LED to show detection
Start0:
warmup:
low ledpir
;========== turn on LED to indicate warm-up mode =========='
for w5 = 1 to 5
high ledpir
pause 500
low ledpir
pause 500
next w5
;------------------------Look for detection ------------------------------------;
Do
pause 3000
serin B.2, T4800, ( "XYZZY" ), b0, b1, b2, b3, b4, b5, b6, b7
;debug ; Show the data received
suspend 1
gosub day ; Check for day / night
gosub power_on
gosub rec_on
gosub light_on
pause 30000 ; Record for 30 sec's
gosub rec_off
gosub light_off
gosub power_off
pause 10000 ; pause 10 sec - delay
resume 1
loop
;========== PIR Section ==========
Start2:
If PIR > 0 then
suspend 0
gosub day ; Check for day / night
gosub power_on
gosub rec_on
gosub light_on
pause 30000 ; Record for 30 sec's
gosub rec_off
gosub light_off
gosub power_off
pause 10000 ; pause 10 sec - delay
resume 0
Else
pause 200
endif
goto Start2