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.

How to load a data on runpower ? (CR1000)


CEBTP Aug 5, 2014 03:53 PM

Greetings,

I'm searching how to keep a result in memory that I can use for "reference"(inital data) even if a breakdown occur.

Is it possible to keep a data in a secondary tabledata and read this data any time ? (secondary the first one will erase by "circulary memory")

Best regards.

* Last updated by: CEBTP on 8/6/2014 @ 5:24 AM *


Dana Aug 5, 2014 06:16 PM

There are two options that might help.

PreserveVariables instruction - This would maintain the values from variables, but not data tables (directly). From the CRBasic help file: "When this instruction is present in a program, variables will not be reinitialized when a program resumes execution after a power failure, or when a program is restarted after it has been stopped using the Stop and Retain Data option (if the Stop and Delete Data option is chosen, the variables will be reinitialized)."

To store the data using PreserveVariable, you could use the GetRecord instruction or data table access syntax to put the most recent record into a variable, which could then be maintained using PreserveVariable.

There is also a CalFile instruction or a FileWrite instruction, but you would have to write to these fairly often to always have the most recent record. Depending upon the frequency of data, this might not be the best option.

See the CRBasic help for information on all these instructions.

Dana


Sam Aug 5, 2014 08:30 PM

Here are some examples I had sent to a customer previously


Using PreserveVariables Instruction:

'Purpose preserve variables
'A, B, C, and D across power cycles
PreserveVariables
Public A, B, C, D
BeginProg
'Do not want D to be preserved
'so going to force to 0
D = 0
Scan (1,Sec,0,0)
NextScan
EndProg


'Use DataTable to preserve
'value of A and B across power cycles

Public A, B, C, D
DataTable (Table,True,1)
Sample (1,A,IEEE4)
Sample (1,B,IEEE4)
EndTable

BeginProg
If A<>NAN Then A = Table.A
If B<>NAN Then B = Table.B
Scan (1,Sec,0,0)
CallTable Table
NextScan
EndProg


CEBTP Aug 6, 2014 11:20 AM

Greetings,

That was so simple, I didn't see this command before >_<.

Thank you.

* Last updated by: CEBTP on 8/6/2014 @ 5:24 AM *

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