File and Program Control
About the File and Program Control Methods
The file and program methods are used to load or clear a COF (Control Object File), run the device's processing chain, or halt the device's processing chain.
File Methods
Program Control Methods
ClearCOF
Clears the program and data buffers on the processor.
int ClearCOF;
Returns:
Clears the Control Object File (COF) and the data buffers on the processor device.
LoadCOF
Loads the Control Object File (*.rco or *.rcx) to the proper ActiveX control. This function/method is run after a Connectxx call and clears anything in the memory buffers on the processor device. See ReadCOF for information about establishing a connection between an ActiveX handle and a COF without clearing a device's memory buffers.
Note: LoadCOF loads the Control Object File in real time allowing programs to utilize multiple Control Object Files if needed.
int LoadCOF(string FileName);
Arguments:
Note: the extension may be omitted for *.rco files but must be specified for *.rcx
Returns:
Loads a Control Object File(COF) i.e. *.rcx. and checks to see if it was properly loaded.
RP=actxserver('RPco.x');
RP.ConnectRP2('GB',1); % Connects to a RP2 via Optical Gigabit
e=RP.LoadCOF('C:\Circuit.rcx'); % Loads circuit
if e==0
disp 'Error loading circuit'
else
disp 'Circuit ready to run'
end
LoadCOFsf
Loads the Control Object File (*.rco or *.rcx) to the proper ActiveX control and sets the sampling frequency of the device. This function/method is run after a Connectxx call and clears anything in the memory buffers on the processor device. See ReadCOF for information about establishing a connection between an ActiveX handle and a COF without clearing a device's memory buffers.
int LoadCOFsf(string FileName, float Sample frequency);
Arguments:
Note: the extension may be omitted for *.rco files but must be specified for *.rcx
Note
The sample frequencies are approximate and are subject to round-off error. Use GetSFreq to determine the actual sample rate.
Choosing a number greater than the maximum sample frequency for an RPx device will set that device to its maximum sample rate (for example: the maximum sample rate for an RL2 is 50 kHz (3) if the sample rate is set to 6 the devices sample rate will be 50 kHz).
PCM A/D and D/A equipped devices such as the RV8 and RX8 allow arbitrary rates to be specified. The PCM converters on these devices will adjust to the sampling rate specified without corrupting data. Sigma-Delta A/D and D/A equipped devices such as the RX6 and RX8 must specify supported realizable sampling rates in order to avoid data corruption. For more information on the realizable sampling rates supported by the Sigma-Delta converters, see . RX8 devices equipped with Sigma-Delta converters should use the realizable sampling rates up to a maximum of 97.65625 kHz.
To use the arbitrary sample frequency on the RV8, RX6, or RX8 use a value greater than 50 for the sample frequency.
Setting the sample frequency for values greater than 6 and less than 50 will generate incorrect sample rates and the circuit will fail to run.
Returns:
Loads a Control Object File(COF), sets the sample rate to 200 kHz i.e. *.rco, and checks to see if it was properly loaded. Also returns the true sample rate of the Device.
[MATLAB] In addition it loads the same COF file and sets the sampling rate to 200 Hz on an RV8
RP=actxserver('RPco.x');
% Connects to an RP2 via Optical Gigabit
RP.ConnectRP2('GB',1);
% Loads circuit sets sample rate to 200 kHz
e=RP.LoadCOFsf('C:\Circuit.rcx',5);
SFreq=RP.GetSFreq
if e==0
disp 'Error loading circuit'
else
disp 'Circuit ready to run'
end
RV8=actxserver('RPco.x');
RV8.ConnectRV8('GB',1);
e=RV8.LoadCOFsf('C:\Circuit.rcx',200)
ReadCOF
Reads the Control Object File (*.rco or *.rcx) to the proper ActiveX control. This function gives the ActiveX handle access to circuit components and parameters without reloading the circuit or clearing the memory buffers on the device. If the ReadCOF file is not the same as the circuit running on the device, the data will be erroneous. This function is primarily for use with portable or remote processor devices such as the stingray Pocket Processor.
int ReadCOF(string FileName);
Arguments:
Returns:
Reads a Control Object File(COF) i.e. *.rco or *.rcx.
RP=actxserver('RPco.x');
% Connects to an RP2 via Optical Gigabit
RP.ConnectRL2('GB',1);
% Reads circuit to ActiveX handle`
e=RP.ReadCOF('C:\Circuit.rcx');
Run
Starts the processor device processing chain. Run should be called after a Connect call and LoadCOF.
int Run;
Arguments:
None.
Returns:
Goes through the connection, load and run procedure and checks to see if the circuit is running.
``` matlab RP=actxserver('RPco.x'); RP.ConnectRP2('GB',1) RP.LoadCOF('C:\Circuit.rcx'); e=RP.Run if e==0
disp 'error running circuit' else disp 'Circuit running' end ```
Halt
Stops the processor device's processing chain.
int Halt;
Returns:
Stops the processor device's processing chain.
e1 = RP.Halt