One of our super users, posed a question. He needed multi-tasking, and asked if it was possible. My first reaction was NO. So was my second reaction. I suggested using callbacks from interrupts, or using multiple processors or the LPC54102 dual CPU.
Well after we thought about it for a while. The ARM BASIC handles interrupts, which really are the equivalent of a context switch. Why not expand that so there could be an arbitrary number of tasks, that are triggered on a timer interrupt.
Here is an example of 4 tasks each wiggling an IO pin while it is running. And the run time for each task is setup in a table. Yes there are some restrictions on what the tasks can do. But in essence here is multitasking on the ARMstamp, LPC1756 and LPC54102.
This was done in BASIC with 4 lines of inline assembly language, more on that later.
Here is the example BASIC source