Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: cyounger on October 09, 2013, 12:42:28 PM

Title: What happens to stage
Post by: cyounger on October 09, 2013, 12:42:28 PM
Got a quick question guys what happens if I am running a stage program from a prgm called auto and it exits due to a fault and exits the program in the middle of say stage 5.  When the prgm. is called to run again will it start with stage 0 (ISG 0 ) or will the pgram start in stage 5 where it left off.
Thanks
Title: Re: What happens to stage
Post by: plcnut on October 09, 2013, 01:44:07 PM
It will go to SG0.
You will have to monitor which stage(s) were active when you EXIT the Code block, and then use SGSET (or JMP) to re-activate them.
Title: Re: What happens to stage
Post by: cyounger on October 09, 2013, 01:47:53 PM
ok thanks I was just making sure that the stage would go back to zero.
Title: Re: What happens to stage
Post by: franji1 on October 09, 2013, 02:37:43 PM
If you ever want the alternative behavior (i.e. start where you left off), look at possibly using the SUSPEND instruction from the "supervisory" program (e.g. $Main would SUSPEND program Auto), instead of EXITing from within 2nd program and re-RUNning from the "supervisory" program which would restart Auto.

We originally wrote SUSPEND as a debugging feature, but it could be utilized for this alternative behavior.  (Note that Time does not accumulate within SUSPENDed code-blocks - so TMRs ALSO "suspend".  Yes, technically, "time stands still"  ;D)
Title: Re: What happens to stage
Post by: rlp122 on October 09, 2013, 04:21:46 PM
Experience slips away. (http://www.youtube.com/watch?v=UTFHwTKWawU)    ::) ::) ::)
Title: Re: What happens to stage
Post by: cyounger on October 10, 2013, 09:24:45 AM
Thanks again the suspend looks interesting I might try it on a future project
Chris