picaxe parallel tasking

peter howarth

New Member
Just want to know which , if any, of the picaxe micros can do parallel tasking, ie more than 1 start block in the flowchart programming chart technique..
 

lbenson

Senior Member
Just want to know which , if any, of the picaxe micros can do parallel tasking
As above, with multiple STARTs, but note that this is time-slicing, not true parallel execution. Usually, a time-slicing operation can also be coded as a single chunk of code. Multiple STARTs can make some kinds of time-slicing conceptually easier to follow.
 

oracacle

Senior Member
It's something that you is have to have parallel take on, or can it be accomplished with well constructed code? I have been increasingly finding that well constructed code can get allot done without even thinking about multi tasking.
 

erco

Senior Member
Picaxe Multitasking introduces as many problems & limitations as it solves. More of a beginner novelty for blinking LEDs at different rates. As others have said, best to avoid if possible.
 

Technoman

Senior Member
I haven't tried but it could be interesting in the education field as an introduction to multitasking. If anyone has a feedback...
However, I think it could be even more difficult for a teacher to track down multitask related problems that arise during a class.
 

hippy

Ex-Staff (retired)
I would say multi-tasking was more than a novelty, and can be quite useful at times; separating button handlers or display code from the main program can simplify design.

It does have its limitations, no SETFREQ, and a blocking command will block all tasks, but it does have its uses. This was my multi-tasking "Button push reaction tester" ...
Code:
#Picaxe 08M2
#No_Data
#Terminal 4800

Symbol BTN       = pinC.3
Symbol timeoutMs = w0

Start0:
  Do
    SerTxd("Press the button ...", CR, LF)
    timeoutMs = 2000
    Do : Loop Until BTN = 1 Or timeoutMs = 0
    If timeoutMs = 0 Then
      SerTxd("Too late!", CR, LF)
    Else
      SerTxd("Well done", CR, LF)
    End If
    Do : Loop Until BTN = 0
    Pause 10000
  Loop

Start1:
  Symbol LOOP_TIME_MS = 100
  Do
    timeoutMs = timeoutMs Min LOOP_TIME_MS - LOOP_TIME_MS
    Pause LOOP_TIME_MS
  Loop
In more complicated code one can simply set 'timeoutMs' wherever one needs a timeout without having to include even a GOSUB or other code.
 
Top