1909 Old Mountain Creek Road, Greenville, SC 29609 tel:864.233.8330 fax:864.233.8331

Simple Multi-tasking

Overview

Simple Multi-tasking 'SMt' allows single-tasking controllers such as the Parallax Basic Stamp, to handle multiple tasks effectively in parallel – with extreme simplicity and efficiency. In addition, this particular implementation also provides an external buffered serial input port capable of 57k baud. It is housed in a small 8 Pin DIP.

With the Stamp itself performing its own multi-tasking there is little new to learn – no RTOS with interrupts, stacks, semaphores, task locking / unlocking, and hard to find bugs – nor any new high level language with concepts foreign to most Users.

Even better, the small difference in coding technique is only used as needed. If there is no need to run many Counters, many Timers, Monitor many pins, buffer 57k Serial data etc, and all in parallel, then all programming is absolutely as normal – no problem, no difference.

That is not true for a RTOS, or a HL language intended specifically for multi-tasking. The User is faced with their foreign concepts all the time - even to turn on an LED.

Stamp Demo

The extreme efficiency of SMt can be seen using the demo program (supplied on CD) where a BS2 achieves the following:

  • The BS2 itself emulates 6 independent Batch Counters each counting at 20 pulses per second

  • At the end of each batch the BS2 drives an output pin for a Timed duration – all 6 periods can coincide/overlap without any ill-effect

  • In parallel with the 6 Counters & 6 Timers, the BS2 exchanges 6 bytes (12 total) 5 times per second with the PC, and at 28k baud

Performance Details

Our definition of a Task is:
Any code that normally occupies the CPU long enough to prohibit other critical or essential code from executing.

That definition identifies the problems a user normally faces when needing to:

  • Time multiple events in parallel rather than sequentially

  • Monitor/count multiple events in parallel

  • Drive multiple R/C servos in parallel

  • Or any combination of the above

Occasionally there are work-around solutions but they are never elegant, and the resulting code is neither easily understood nor maintained.

With SMt, the BS2 for example is completely transformed and is able to achieve the following performance in the above categories as the sole function:

  • (Max RAM-1) 25 Independent Timers in parallel at 10mS resolution

  • (Max RAM-3 in Words) 11 Motors running at 1500 RPM – or 11 Counters at 50 pulses/sec

  • 2x4 Servos in parallel, or 3x4 servos at 30ms refresh rate

  • Or any partial combinations of the above within the available BS2 resources

Where does the increase in performance come from?

It is not so much an increase in performance, as avoiding losses. 

SMt recovers an enormous amount of CPU time that is typically lost in Stamp control applications. At the same time it avoids the need for Interrupts, and therefore consumes only the absolute minimum of resources. Yet further, it recognizes that the rate of Task switching only needs to match the Tasks at hand. 

The effectiveness is best demonstrated by the Robotics and PLC applications. SMt has 'Patent Pending' status.

Plus Hardware Multi-tasking

Whilst SMt can allow a Stamp to multi-task its existing functions, it cannot add to those functions, they are internal to the Stamp. Hence the frequent need for buffered Serial Receive is implemented externally, and within the co-processor itself. The host still handles the serial Transmit.

The main Receive features are as follows:

  • Up to 57k baud Buffered Receive

  • Fast shift in of the Buffered Data at the Stamp's convenience

  • Optional Qualifier byte for Multi-Drop Networks, and safe Wireless Receive (see other recommendations elsewhere)

  • Optional CheckSum protection

  • Optional Message length in Header

Buffered serial communication is a valuable function even when the multi-tasking is not needed, or is being held in reserve.

Optional 'Virtual Controls for Micros' PC software

Multi-tasking plus serial communication in parallel can bring many new applications within the reach of a Stamp type controller.

This can be expanded yet further, with a simple and instant Graphical interface with the PC. See the Meters, Thermometers, Gauges, Sliders, Real-time Clock plus Calendar, and LEDs etc., and download a demo version.