Using restart/resume with multi task

69-cat

Member
Question, I use this for triggering 10 watt LED strobes with a PIR for Halloween and noticed if I add another output "START5" the chip stops working. Is 4 the limit with this configuration?
Dave

Code:
[color=Navy]#Picaxe [/color][color=Black]14m2[/color]
[color=Blue]symbol [/color][color=Purple]PIR [/color][color=DarkCyan]= [/color][color=Purple]pinc.3[/color]
[color=Blue]symbol strobe1 [/color][color=DarkCyan]= [/color][color=Blue]B.1
symbol strobe2 [/color][color=DarkCyan]= [/color][color=Blue]B.2
symbol strobe3 [/color][color=DarkCyan]= [/color][color=Blue]B.3
symbol strobe4 [/color][color=DarkCyan]= [/color][color=Blue]B.4

pause [/color][color=Navy]45000             [/color][color=Green]'time for the PIR to settle [/color]
[color=Black]main:[/color]
[color=Blue]if [/color][color=Purple]PIR[/color][color=DarkCyan]=[/color][color=Navy]0 [/color][color=Blue]then [/color][color=Black]main[/color]

[color=Blue]resume [/color][color=Navy]1[/color]
[color=Blue]resume [/color][color=Navy]2[/color]
[color=Blue]resume [/color][color=Navy]3[/color]
[color=Blue]resume [/color][color=Navy]4[/color]

[color=Blue]Pause [/color][color=Navy]10000[/color]

[color=Blue]restart [/color][color=Navy]1[/color]
[color=Blue]restart [/color][color=Navy]2[/color]
[color=Blue]restart [/color][color=Navy]3[/color]
[color=Blue]restart [/color][color=Navy]4[/color]

[color=Blue]goto [/color][color=Black]main[/color]

[color=Blue]start1:
  low strobe1
  suspend [/color][color=Navy]1
  [/color][color=Blue]do
    high strobe1 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]25
    [/color][color=Blue]low  strobe1 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]65
  [/color][color=Blue]loop

start2:
  low strobe2
  suspend [/color][color=Navy]2
  [/color][color=Blue]do
    high strobe2 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]30
    [/color][color=Blue]low  strobe2 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]55
  [/color][color=Blue]loop

start3:
  low strobe3
  suspend [/color][color=Navy]3
  [/color][color=Blue]do
    high strobe3 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]25
    [/color][color=Blue]low  strobe3 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]60
  [/color][color=Blue]loop

start4:
  low strobe4
  suspend [/color][color=Navy]4
  [/color][color=Blue]do
    high strobe4 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]30
    [/color][color=Blue]low  strobe4 [/color][color=Black]: [/color][color=Blue]pause [/color][color=Navy]50
  [/color][color=Blue]loop[/color]
 

westaust55

Moderator
Only the 08M2 and the original 18M2 are limited to 4 tasks (0 to 3).
The later 18M2+ and the 14M2 & 20M2 are capable of 8 tasks (0 to 7).

Start0 is implied as the first task at the first line of code if the label Start0 is not specifically included.

Currently Not at a PC to test but suggest you indicate which version of the Programming editor you are using.
 

westaust55

Moderator
Under 6.0.9.2 (6.0.9.3 is latest) the following passes syntax and will simulate correctly.
I reduced the duration of the two PAUSE comments in the main loop to make simulation faster.

Can you clarify if with PE V6.0.7.3 you could get the PE to pass on syntax and simulate correctly?
Is the problem limited to operation in an actual 14M2 chip?

Code:
#Picaxe 14m2
symbol PIR = pinc.3
symbol strobe1 = B.1
symbol strobe2 = B.2
symbol strobe3 = B.3
symbol strobe4 = B.4
symbol strobe5 = B.5


pause 1000 ; 45000             'time for the PIR to settle 
main:
if PIR=0 then main

resume 1
resume 2
resume 3
resume 4
resume 5

Pause 1000 ; 10000

restart 1
restart 2
restart 3
restart 4
restart 5

goto main

start1:
  low strobe1
  suspend 1
  do
    high strobe1 : pause 25
    low  strobe1 : pause 65
  loop

start2:
  low strobe2
  suspend 2
  do
    high strobe2 : pause 30
    low  strobe2 : pause 55
  loop

start3:
  low strobe3
  suspend 3
  do
    high strobe3 : pause 25
    low  strobe3 : pause 60
  loop

start4:
  low strobe4
  suspend 4
  do
    high strobe4 : pause 30
    low  strobe4 : pause 50
  loop

start5:
  low strobe5
  suspend 5
  do
    high strobe5 : pause 30
    low  strobe5 : pause 50
  loop
 
Last edited:

hippy

Technical Support
Staff member
I can't see any reason why the code wouldn't work just as well for six tasks as it does for five. It would be worth upgrading PICAXE Editor to the latest but I would doubt that is the issue.

Perhaps it's the addition of another set of strobes, or something about the strobe last added, which causes the problem. You could try only restarting task 5 to see if that works. It might be that in triggering all five sets of strobes that causes a PICAXE reset. You could add a SERTXD() at the start of the program to determine if that is happening or not.
 

69-cat

Member
It looks like the version was the issue "so far" I have another bug that I see but would like to troubleshoot first. Myself, I like learning from my mistakes. I think that is the best way you learn how to solve problems. Thank you for bringing the version of the software to light, I never gave that a thought.....
Dave
 
Top