Skip to content

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:

Type Value Description
int 0 Not successful.
int 1 Successful.

Clears the Control Object File (COF) and the data buffers on the processor device.

MATLAB el=RP.ClearCOF

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:

Type Argument Description
string *.rco file or *.rcx File name and extension

Note: the extension may be omitted for *.rco files but must be specified for *.rcx

Returns:

Type Value Description
int 0 Not successful.
int 1 Successful.

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:

Type Argument Description
string *.rco file or *.rcx File name and extension

Note: the extension may be omitted for *.rco files but must be specified for *.rcx

Type Argument Description
float Sample Frequency Values above 50 are used for arbitrary waveform generation.
0 1 2 3 4 5 6 >=50
6K 12K 25K 50K 100K 200K 400K Arbitrary Sample rate
ALL ALL ALL RP2 RP2.1 RL2 RV8 RX6 RX8 RZ2 RZ5 RZ6 D/A Only RA16BA RX5 RP2 RP2.1 RL2 RV8 RX6 RX8 RZ6 D/A Only RX5 RP2 RP2.1 RV8 RX6 RZ6 RV8 RX6 RV8 RX6 RX8

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:

Type Value Description
int 0 Not successful.
int 1 Successful.

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:

Type Argument Description
string *.rco or *.rcx file File name (the extension does not need to be included).

Returns:

Type Value Description
int 0 Not successful.
int 1 Successful.

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:

Type Value Description
int 0 Not successful.
int 1 Successful.

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:

Type Value Description
int 0 Not successful.
int 1 Successful.

Stops the processor device's processing chain.

e1 = RP.Halt