Device Status
About the Device Status Methods
The device status methods return information to specific device characteristics such as the device's status, cycle usage, sampling frequency, number of total components in the COF file, and the names of any of the COF file components.
Device Status Methods
GetStatus
Checks the status of the device and reports the state of various status indicators. A 0 or 1 is reported for each indicator and each indicator is reported as a single bit in a binary number. The binary number, including information about all possible indicators, is returned as an integer.
While each device type can have different status indicators, the first three bits return the same basic status information about the connection and circuit status on all devices. The return values in the table below are possible for the first three status bits on all devices. However, use bit-wise operations (0/1) instead of inspecting the integer value for best results.
Bitmasks remain constant while integer values change as new Bitmasks are added to GetStatus() in the future.
int GetStatus;
Arguments:
None
Returns:
int
Note: When checking the status of the Medusa Base Station (RA16BA), ensure that a preamplifier is properly connected and turned on. Connection status (Bit 0) will always return a 0 when a preamplifier is not properly connected. Bit 5 (amplifier clipped since last call) is reset after GetStatus is called.
Bit-0 does not report preamplifier status when using an RZ base station. Use the RZ LCD screen to determine PZ status.
Checks if the circuit is loaded and running. Determines where in the loading routine the error occurred.
Status = double(RP.GetStatus); % Gets the status
% Checks for errors in starting circuit
if bitget(Status,1) == 0;
er = 'Error connecting to RP'
elseif bitget(Status,2) == 0; % Checks for connection
er = 'Error loading circuit'
elseif bitget(Status,3) == 0
er = 'error running circuit'
else
er = 'Circuit loaded and running'
end
GetCycUse
Checks the total cycle usage of a specified processor device. GetCycUse polls the processor device and returns an integer value between (0-100).
Note: If the value returned is greater than 100, the value will fold back within the 0-100 range (for example, a cycle usage of 130% would return a value of 30). To determine if cycle usage is too high, lower the sampling rate by a factor of 2. The cycle usage should be one-half the former value. (For example, if GetCycUse returns a value of 30, halving the sample rate should reduce the cycle usage to 15%. If, after halving the sample rate, the cycle usage is 65, you know that the original cycle usage was 130% not 30%.)
int GetCycUse;
Arguments:
None.
Returns:
Warns if the cycle usage is over 90%.
if RP.GetCycUse < 90
disp 'System within cycle usage limits'
else
disp 'Warning: reaching upper limits of cycle usage'
end
See also: Device Checker in the ActiveX examples.
GetSFreq
Returns the exact sampling frequency of the processor device.
float GetSFreq;
Arguments:
None
Returns:
Checks the sampling frequency and warns if a tone frequency is below the nyquist value of the circuit.
if ToneFreq > RP.GetSFreq/2
disp 'Tone above Nyquist value'
else
disp 'Tone Freq below Nyquist'
end
GetNumOf
Returns the number of components, parameter tags, parameter tables, or SrcFiles in a *.rco file.
int GetNumOf(string Name)
Arguments:
Returns:
Finds the number of Parameter Tags and returns their StringID
TagNum = double(RP.GetNumOf('ParTag'))
for loop=1:TagNum
TagName{loop} = RP.GetNameOf('ParTag', loop)
end
See also: Device Checker in the ActiveX examples.
GetNameOf
Returns the name given to a particular parameter tag, component, data table, or source file in a processor device chain. The string 'NoName' will be returned if the object was not explicitly named in the RPvdsEx circuit. This function can be used in conjunction with GetNumOf() to return a list of all parameter tags in an RCO file.
string GetNameOf(string Name, int Component_#)
Arguments:
Returns:
Finds the number of parameter tags and returns their source name.
TagNum=double(RP.GetNumOf('ParTag'))
for loop=1:TagNum
TagName{loop} = RP.GetNameOf('ParTag', loop)
end
See also: Device Checker in the ActiveX examples.