08m parallel tasks

fran1942

New Member
Hello, I was just wondering whether an 08m or an 08m2 perform the following parallel tasks:

1: play a tune continuously eg:
tune 0, 8,($64m, $69, $25 etc. etc.)

and at the same time
2: output a continuous sequence of highs and lows from two pins:

for b0 = 0 to 4
low 0
high 1
pause 3000
high 0
low 1
next b0


thanks for your help.
 

inglewoodpete

Senior Member
Not really. Each PICAXE in the range only has a single processing core. The tune command takes exclusive control of the processor.

It could be done after a fashion by using a lookup table and playing each note individually. In between each note you could toggle your outputs.

The best solution would be to have a master chip determining the simple things like timing for the tunes ad LEDs. The timing for the tunes would be sent to a second PICAXE, whose job would just be to monitor its inputs and play tunes.
 

westaust55

Moderator
The earlier 08M can only perform one command at a time in sequence and thus while playing the tune command or any other command cannot perform another task in any context of "parallel" operation.
Unless you can generate a BASIC program as suggested by IWP your idea is impossible.
I did post a program a couple of years back to read a series of data from memory and use the sound command to emulate the TUNE command. Try a search for that code.
Whether you can tweak that to do some some other functions between each note I leave to you to experiment with but at 8MHz max seems low probability.

The newer 08M2 as IWP has indicated only has a single core in emulates parallel processing by use of the "time slice" concept as has been used in the past by computers.
Still only one thing done at any instant in time but alternates between the two program streams relatively quickly.
Some commands such as SERIN will hold all processes until the SERIN command in one program stream is completed.
with 16 MHz in multi-start mode you do stand a better chance of doing something between sending tones/sounds on one code sequence.
Give it a try and see how you get on.
 
Top