Scan a range of channels continuously while waiting for a trigger. Once the trigger occurs, return the specified number of samples including the specified number of pre-trigger samples to a disk file. This function waits for a trigger signal to occur on the Trigger Input. Once the trigger occurs, it returns the specified number (TotalCount) of A/D samples including the specified number of pre-trigger points. It collects the data at the specified sampling rate (Rate) from the specified range (LowChan-HighChan) of A/D channels from the specified board. If the A/D board has programmable gain then it sets the gain to the specified range. The collected data is returned to a file. See board specific info to determine if this function is supported by your board.
C/C++
int cbFilePretrig(int BoardNum, int LowChan, int HighChan, long *PretrigCount, long *TotalCount, long *Rate, int Range, char *FileName, unsigned Options)
Visual Basic
Function cbFilePretrig(ByVal BoardNum&, ByVal LowChan&, ByVal HighChan&, PretrigCount&, TotalCount&, Rate&, ByVal Range&, ByVal FileName$, ByVal Options&) As Long
BoardNum
The number associated with the board when it was installed with InstaCal. The specified board must have an A/D and pretrigger capability. BoardNum may be 0 to 99.
LowChan
First A/D channel of the scan.
HighChan
Last A/D channel of the scan.
The maximum allowable channel depends on which type of A/D board is being used. For boards that have both single ended and differential inputs the maximum allowable channel number also depends on how the board is configured Refer to board-specific information for the maximum number of channels allowed in differential and single ended modes.
PretrigCount
Specifies the number of samples before the trigger that will be returned. PretrigCount must be less than 16000 and PretrigCount must also be less than TotalCount - 512.
If the trigger occurs too early, then fewer than the requested number of pre-trigger samples will be collected. In that case a TOOFEW error will occur. The PretrigCount will be set to indicate how many samples were collected and the post trigger samples will still be collected.
TotalCount
Specifies the total number of samples that will be collected and stored in the file. TotalCount must be greater than or equal to PretrigCount + 512. If the trigger occurs too early then fewer than the requested number of samples will be collected. In that case a TOOFEW error will occur. The TotalCount will be set to indicate how many samples were actually collected.
Rate
Sample rate in samples per second (Hz) per channel. The maximum sampling rate depends on the A/D board that is being used. This is the rate at which scans are triggered. If you are sampling 4 channels, 0 - 3, then specifying a rate of 10,000 scans per second (10 kHz) will result in the A/D converter rate of 40 kHz: 4 channels at 10,000 samples per channel per second. This is different from some software where you specify the total A/D chip rate. In those systems, the per channel rate is equal to the A/D rate divided by the number of channels in a scan. This argument also returns the value of the actual set. This may be different from the requested rate because of pacer limitations.
Range
If the selected A/D board does not have a programmable range feature, this argument is ignored. Otherwise, set the Range argument to any range that is supported by the selected A/D board. Refer to board specific information for a list of the supported A/D ranges of each board.
FileName
The name of the file in which to store the data. If the file doesn't exist, it will be created.
Options
Bit fields that control various options. Refer to the constants in the Options argument values section below.
EXTCLOCK | If this option is used then conversions will be controlled by the signal on the trigger input line rather than by the internal pacer clock. Each conversion will be triggered on the appropriate edge of the trigger input signal (refer to board-specific information in the Universal Library User's Guide). When this option is used the Rate argument is ignored. The sampling rate is dependent on the trigger signal. |
DTCONNECT | Samples are sent to the DT-Connect port if the board is equipped with one. |