Using slots, what must be re-declaired?

Dave E

Senior Member
Hello all,
I am writing a program that is large enough to require using another SLOT. In the SLOT0 program I use SETTIMER to produce a 1/100 second timer. Anytime the program runs SLOT1 then goes back to SLOT0 it looks like TIMER defaults to a 1 second timer. If I use the SETTIMER command to set up the 1/100 second timer every time there is a transition from SLOT1 to SLOT0 then all seems to work. I also use a PWM output that is declaired in SLOT0 but not SLOT1. This PWM output does not get re-declaired after SLOT 1 runs either but it seems to be unaffected.

QUESTIONS: Is this normal? Does the SETTIMER command need to be re-declaired every time I run SLOT0 eventhough it is not used in SLOT1? If so, why does the the transition from one SLOT to another not affect the PWM output? And lastly, what other commands are affected when the program goes from one slot to another?

Any input will be welcome.
Dave E
 

oracacle

Senior Member
i would assume it is normal from manual 2

To run the second program (after downloading with a #slot 1 directive) use the
command ‘run 1’. This command stops the current program and starts the second
program running immediately. Variables and pin conditions are not reset, so can
be shared between the programs. However all other system functions, such as the
gosub/return stack, are reset when the second program starts. Therefore slot 1
program can only be considered as a a ‘goto’ from the slot 0 program, not a
‘gosub’.
PWM is background task which is why i wold think that is not affected by slot transistion, it should nt be altered unless a PWM comand is given or the picaxe is restarted

also as a side note, it maybe helpful if you put your symbols in an include file at share both between each of the programmes so you don accidentialy overwright data that need to be used in either programme.
 

Dave E

Senior Member
Thanks for the reply oracacle.
I have read that section of Manual 2 several times but it did not seem to help me solve this issue. It is a bit vague to me because I am not sure which functions are considered system functions. That brings me back to my last question: What commands / system functions are affected by running different slots?

Dave E
 

oracacle

Senior Member
well the way i read it, all of them accept for the ones you have found to be un-affected, so you have found that PWM seems to be unaffected, and the manual states pin state and variable value are unaffected (maybe why PWM is unaffected, is it a pins state more than a comand?)

it may help if you post your code, i quick scan shows that debug can affect the timer.

from my undstaning the run ... is essentially a goto main of a new programme (say you have 2 programmes in one slot) with the added affect of removing any comands left over from the previous programme.
 
Top