Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

FileManage - how to skip back to "Main"program


uwe Jan 6, 2011 05:43 AM

Hi evberybody!

A CR1000 "Main" program starts a second program via the FileManage instruction. This works well!
But then the system remains in the second program aven though the EndProg statement is reached (FileControl reports the second program running).
How to skip back into the "Main" pürogram correctly?

Thanks and Regards
uwe


jra Jan 6, 2011 02:17 PM

uwe,

The quick answer is that you'd use another FileManage instruction in the secondary program to get back to the "main" one.

However, there is probably a better way to do what you are trying to do. Most applications do not need the datalogger to automatically switch back and forth between main and secondary programs. What are you trying to accomplish by switching between the main and secondary programs?

Janet


Sam Jan 11, 2011 07:16 AM

Agreed. It is rare to require a logger to swap back and forth between programs under CRBasic control.

But for demonstration sake, what the heck ...
Each program below should run for 50 seconds and then launch the other program - back and forth.

'FILE NAME = ONE.CR1
Public CounterOne
DataTable (DataOne,1,1000)
TableFile ("USR:DataOne",8,-1,5,0,Hr,0,"")
Sample (1,CounterOne,FP2)
EndTable
BeginProg
SetStatus("USRDriveSize",10000)
Scan (5,Sec,0,10) 'do it 10 times
CounterOne = CounterOne + 1
CallTable DataOne
NextScan
FileManage ("CPU:TWO.CR1",4)
EndProg

'FILE NAME = TWO.CR1
Public CounterTwo
DataTable (DataTwo,1,1000)
TableFile ("USR:DataTwo",8,-1,5,0,Hr,0,"")
Sample (1,CounterTwo,FP2)
EndTable
BeginProg
SetStatus("USRDriveSize",10000)
Scan (5,Sec,0,10) 'do it 10 times
CounterTwo = CounterTwo + 1
CallTable DataTwo
NextScan
FileManage ("CPU:ONE.CR1",4)
EndProg


uwe Jan 11, 2011 09:49 AM

Dear Janet, Dear Sam,

thank you very much for your posts. I agree, this might be a rare problem and therefore not really of common interest. I will give some background via your support email.
Thanks a lot and best regards
uwe

Log in or register to post/reply in the forum.