Quote Originally Posted by Dave View Post
CuriousOne, The Parallax Propeller is truly a multicore processor. You would need multiple Pic's to do the same.
I don't see the difference in your code next to what I am suggesting? The way your's is written it will not produce the output you require.And what do you mean terminated? How about this for an interrupt example:
a = 1
MAIN:
if Interrupt = 1 then
Interrupt = 0
if PROG = 0 then
gosub program 1
else
gosub program 2
endif
endif
a = a + 1
if a > 10 then a = 0
goto main

Program1:
PRINT "A=";A
return

Program2:
PRINT "B=";B
return

This will produce the output you require.

Or without interrupts, Your way..
A=1
B=1
DO:
PRINT "A=";A
PRINT "B=";B
A=A+1
B=B+1
IF A > 10 THEN A = 1
IF B > 10 THEN B = 1
LOOP

This will produce the same output you require.
The main difference is that I need it to work like this:

advance code 1
advance code 2
loop

The "PRINT" was just an example, of course if I want to print two variables at same time, I know how to do this

And doing it in both way means that I have to prematurely exit from FOR/NEXT loop, and I can't return to inside it.

Let me explain once again what I need.

In above example, I have two for/next loops, each with 10 steps. Is there a way to execute them like one step from code a, one step from code b and so on. Execute by not modifying code as you did (because it works for this certain case, but in real life it might be totally impossible to do like you did), but just distributing processor time between two codes ?