Other
GetDevCfg
GetDevCfg is used with the RV8. After setting the number of sweeps with SetDevCfg, you can use this function to determine the number of sweeps remaining on the RV8. At this time, only the information pertaining to the remaining sweeps can be retrieved from the device.
int GetDevCfg(int Address, int Wide32)
Arguments:
Returns:
Finds the number of sweeps left on the RV8.
Sweeps_Left = RP.GetDevCfg(9, 0);
SetDevCfg
SetDevCfg is used with the RV8. It allows direct access to memory locations for the control of the RV8 special modes, sample number, trigger counter and bit logic.
int SetDevCfg(int Address, int Value, int Wide32)
Arguments:
Returns:
Enabling the Trigger Mode
The Trigger mode requires that you set two components of the Special Mode: Bitmask 1 and one of the Three trigger types (zBUSA, zBUSB or External). Note only one of the three trigger types (zBUSA, zBUSB or External) can be enabled at any time. Additional modes that might be enabled are multiple trigger and AutoClr.
Multiple trigger allows users to trigger the RV8 with out halting and running the chain again. In addition It allows users to set the maximum number of times a system can be triggered. To set the Multiple Trigger requires that you also set the Sweep Count. Sweep Count can be set to any value between 1 and 4,294,967,296.
AutoClr: AutoClr sets the DAC outs to 0. If AutoClr is not set the last value sent to the DAC's is played out.
Setting the Sample Count
In the Trigger mode the sample count needs to be a value greater than zero otherwise the signal will play for a int time. There are two ways to set the Sample Count. The Lower and Upper Count addresses can be set separately or by setting wide32=1 in the SetDevCfg it allows users to set the value for both upper and lower addresses. TDT recommends that wide32 be used to set the value. The example below shows the difference.
Setting the Sample Count for 300,000 with wide32. In this case it is a matter of using the actual value.
RV8.SetDevCfg(2,300000,1)
Setting the Sample Count for 300,000 without wide32.
300,000 needs to be converted to a hexadecimal value and then split into the lower and upper 16-bit values. In this cause the lower 16-bit value is 37,856. The Upper 16-bit value is 4.
RV8.SetDevCfg(2,37856,0)
RV8.SetDevCfg(3,4,0)
Setting Multiple Triggering
In Single Trigger mode the circuit needs to be halted and run after each trigger. In Multiple trigger mode the circuit can be configured to be triggered several times before the circuit needs to be halted. The code below sets the circuit to trigger 5 times before it needs to be reset. The maximum number of times a circuit can be triggered is by setting this variable is 65535. If sweep count is set to 0 (default) the circuit will trigger a near infinite number of times.
RV8.SetDevCfg(09,5,0)
Using the zTRIG Option
To use the zTRIGB or UsezTRIGA option you need to use the zBUS ActiveX controls. Your code should include a connection to the . The example code below shows how this would work. Make sure that the ActiveX control is active in your program. Note it is not necessary to have a Trigger component in the circuit.
zBUS.ConnectZBUS('GB')
RV8.ConnectRV8('GB',1)
RV8.LoadCOF('C:\Circuit.rcx')
%Triggers off zBUSA, AutoClr, and multiple trigger
RV8.SetDevCfg(0,147,0)
RV8.SetDevCfg(2,30000,1) %Plays out 30000 samples
%Triggers up to 10 times before stopping
RV8.SetDevCfg(9,10,1)
RV8.Run
zBUS.zBUSTrigA(0,0,10) %Triggers the RV8
%Returns the number of sweeps left
sweepcount=RV8.GetDevCfg(9,0)
SoftTrg
Sends a software trigger to the processor device. There are ten software triggers for each processor device.
Note: Do not use software triggers for signal generation or acquisition that requires precise timing. Software triggers are affected by USB transfer times. Expect a 2-4 ms delay for each call to the processor device from the SoftTrg(). If multiple devices need to be triggered simultaneously use zBusTrigA/B().
int SoftTrg(int Trg_Bitn);
Arguments:
Returns:
MATLAB
This starts one of ten possible software triggers.
error1=RP.run
error2=RP.SoftTrg(1)
See also: Continuous Play, Continuous Acquire, and Two Channel Continuous Acquire in the ActiveX examples.
SendParTable
Sends data from a DataTable to its output.
int SendParTable(string Name, float IndexID);
Arguments:
Returns:
Cycles through three filters for the same input. Allows changes in the filter coefficients from a data table.
for n = 1:3
e1 = RP.SendParTable('PTab', n);
if e1==0
disp 'Filter incorrectly loaded'
else
disp ['Filter' num2str(n) ' loaded']
end
See also: FIR Filtered Noise in the ActiveX examples.
SendSrcFile
Sends data from a data file (specified in a SourceFile Component) into the processing chain. This allows programmers to load a data file from the PC directly to a RAM buffer.
Note
SourceFile supports the following data types: Float Point (32-bit), Long Int(32 bit), Int (16-bit), Ascii, and Wav formats.
SendSrcFile gives you control over the size of data transferred and the position in the data file that SendSrcFile starts. A file can contain many waveforms that are played at different times or in different circumstances.
16-bit words are padded to fit the 32-bit format of the Data Buffers.
Note that this method does not let you specify a new filename to load. This can only be done in the RPvds circuit. If you need to load data from different files, you would first load it into a PC buffer and then use to send the data to a buffer on the processor device.
int SendSrcFile(string Name, int SeekOS, int nWords)
Arguments:
Returns:
This code finds the number of SrcFiles, gets the String ID of the last SrcFile and sends a portion of the PC data file to the processor device.
SrcFile1=RP.GetNumof('SrcFile')
SFile=RP.GetNameOf('SrcFile', SrcFile1)
test=RP.SendSrcFile(SFile, 1000, 50000);