PhilHornby
Senior Member
You could argue this is a firmware bug - but it's probably most easily fixed in the editor. If you stop people like me typing rubbish in, you don't get rubbish out
The following program loops indefinitely, incrementing and printing the value of W0. It pauses 1000mS between loops. The value of OSCCON is printed, to determine if multi-tasking is actually in use.
If the initial label is set to "start", you get the expected output:-
Changing the label to "start0" doesn't change anything.
Changing the label to "start1" is very weird... I would suggest this condition should be detected and prohibited...it's as though it runs Task #1 twice, because there's no Task #0
Changing the label back to "start0" and adding a 2nd task: "Start1: pause 65535 : goto Start1" :-
What I find equally strange, is that this is reproducible in the simulator too (though not the OSCCON check).
The following program loops indefinitely, incrementing and printing the value of W0. It pauses 1000mS between loops. The value of OSCCON is printed, to determine if multi-tasking is actually in use.
Rich (BB code):
#picaxe 08M2
#terminal 4800
;Demonstration of doubled-up commands when multi-tasking enabled (incorrectly).
;Change "start" to "start1:" to show the issue:-
start:
peeksfr $39,b0 ;Doesn't work in simulator.
sertxd (cr,lf,"OSCCON=",#b0) ;Show clock freq (104=4MHz,120=16MHz)
W0 = 0
do
sertxd(cr,lf,"Msg #",#W0,",TIME:",#TIME)
inc W0
pause 1000
loop
;start1: pause 65535 : goto start1
OSCCON=104 (4MHz.)
Msg #0,TIME:0
Msg #1,TIME:1
Msg #2,TIME:2
Msg #3,TIME:3
Msg #4,TIME:4
Msg #5,TIME:5
Changing the label to "start0" doesn't change anything.
OSCCON=104 (4MHz)
Msg #0,TIME:0
Msg #1,TIME:1
Msg #2,TIME:2
Msg #3,TIME:3
Msg #4,TIME:4
Msg #5,TIME:5
Changing the label to "start1" is very weird... I would suggest this condition should be detected and prohibited...it's as though it runs Task #1 twice, because there's no Task #0
OSCCON=120 (16MHz)
Msg #0,TIME:0
Msg #0,TIME:0
Msg #2,TIME:1
Msg #2,TIME:1
Msg #4,TIME:2
Msg #4,TIME:2
Msg #6,TIME:3
Msg #6,TIME:3
Changing the label back to "start0" and adding a 2nd task: "Start1: pause 65535 : goto Start1" :-
OSCCON=120 (16MHz)
Msg #0,TIME:0
Msg #1,TIME:1
Msg #2,TIME:2
Msg #3,TIME:3
Msg #4,TIME:4
Msg #5,TIME:5
What I find equally strange, is that this is reproducible in the simulator too (though not the OSCCON check).
Last edited: