Waits for a trigger to occur and then returns a specified number of analog samples before and after the trigger occurred. If only 'polled gate' triggering is supported, the trigger input line (refer to the User's Guide for the hardware) must be at TTL low before this method is called, or a TrigState error will occur. The trigger occurs when the trigger condition is met. Refer to the SetTrigger() method for more details.
Member of the MccBoard class.
VB .NET
Public Function APreTrig(ByVal lowChan As Integer, ByVal highChan As Integer, ByRef pretrigCount As Integer, ByRef totalCount As Integer, ByRef rate As Integer, ByVal range As MccDaq.Range, ByVal memHandle As IntPtr, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo
C# .NET
public MccDaq.ErrorInfo APreTrig(int lowChan, int highChan, ref int pretrigCount, ref int totalCount,ref int rate, MccDaq.Range range, IntPtr memHandle, MccDaq.ScanOptions options)
The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.
VB .NET
Public Function APreTrig(ByVal lowChan As Integer, ByVal highChan As Integer, ByRef pretrigCount As Integer, ByRef totalCount As Integer, ByRef rate As Integer, ByVal range As MccDaq.Range, ByVal memHandle As Integer, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo
C# .NET
public MccDaq.ErrorInfo APreTrig(int lowChan, int highChan, ref int pretrigCount, ref int totalCount, ref int rate, MccDaq.Range range, int memHandle, MccDaq.ScanOptions options)
lowChan
First A/D channel of scan.
highChan
Last A/D channel of scan.
lowChan/highChan: The maximum allowable channel depends on which type of A/D board is being used. When a board has both single ended and differential inputs, the maximum allowable channel number also depends on how the board is configured (such as 8 channels for DIFF inputs, and 16 channels for SE inputs).
pretrigCount
Number of pre-trigger A/D samples to collect. Specifies the number of samples to collect before the trigger occurs.
For products using a hardware implementation of pretrigger (most products), pretrigCount must be less than the (totalCount – 512). For these devices, if the trigger occurs too early, fewer than the requested number of pre-trigger samples are collected, and a TOOFEW error occurs. The pretrigCount is set to indicate how many samples were actually collected. The post trigger samples will still be collected.
For software implementations of pretrigger, pretrigCount must be less than totalCount. For these devices, triggers that occur before the requested number of pre-trigger samples are collected are ignored. See board-specific information.
totalCount
Total number of A/D samples to collect. Specifies the total number of samples that will be collected and stored in the buffer.
For products using a hardware implementation of pretrigger (most products), totalCount must be greater than or equal to the pretrigCount + 512. If the trigger occurs too early, fewer than the requested number of samples will be collected, and a TooFew error will occur. The totalCount will be set to indicate how many samples were actually collected.
For software implementations of pretrigger, totalCount must be greater than pretrigCount. For these devices, triggers that occur before the requested number of pre-trigger samples are collected are ignored. See board-specific information.
totalCount must be evenly divisible by the number of channels being scanned. If it is not, this method will adjust the number (down) to the next valid value and return that value to the totalCount parameter.
pretrigCount must also be evenly divisible by the number of channels being scanned. If it is not, this function will adjust the number (up) to the next valid value and return that value to the pretrigCount parameter.
rate
Sample rate in scans per second.
range
A/D Range code. If the selected A/D board does not have a programmable gain feature, this parameter is ignored. Otherwise, set 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.
memHandle
Handle for Windows buffer to store data. This buffer must have been previously allocated with the WinBufAlloc() method.
For hardware trigger types, the buffer referenced by memHandle must be big enough to hold at least totalCount + 512 integers.
options
Bit fields that control various options. Refer to the constants in the options Parameter Values section below.
All of the options settings are MccDaq.ScanOptions enumerated constants. To set a variable to one of these constants, you must refer to the MccDaq object and the ScanOptions enumeration (variable = MccDaq.ScanOptions.DtConnect, variable = MccDaq.ScanOptions.ExtMemory, etc.).
Background | If the Background option is not used, the APretrig() method will not return to your program until all of the requested data has been collected and returned to the buffer. When the Background option is used, control returns immediately to the next line in your program, and the data collection from the A/D into the buffer will continue in the background. Use GetStatus() with AiFunction to check on the status of the background operation. Alternatively, some boards support EnableEvent() for event notification of changes in status of BACKGROUND scans. Use StopBackground() with AiFunction to terminate the background process before it has completed. Call StopBackground() after normal termination of all background methods to clear variables and flags. For hardware trigger types, you cannot use the ConvertData option in combination with the Background option for this method. To correctly order and parse the data, use AConvertPretrigData() after the function completes. |
ConvertData | For hardware trigger types, the data is collected into a "circular" buffer. The ConvertData option is used to align data within the buffer when the data acquisition is complete. This option is ignored for all 16-bit devices, and for 12-bit devices that store the data without an offset (refer to AInScan()). Note that you can also call AConvertPretrigData() to align data within the buffer when the data acquisition is complete. >Use of ConvertData is recommended unless one of the following two conditions exist: 1) On some devices, ConvertData may not be specified if you are using the Background option and DMA transfers. In this case, if data conversion is required, use AConvertData() to re-align the data. 2) Some 12-bit boards store the data as a 12-bit A/D value and a 4-bit channel number. Using ConvertData will strip out the channel number from the data. If you prefer to store the channel number as well as the data, call AConvertData() to retrieve the data and the channel number from the buffer after the data acquisition to the buffer is complete. The ConvertData option is not required for software triggered types. |
ExtClock | This option is available only for boards that have separate inputs for external pacer and external trigger. See your hardware manual or refer to the board-specific information in the UL Users Guide. |
ExtMemory | Causes this method to send the data to a connected memory board via the DT-Connect interface rather than returning the data to the buffer. If you use this option to send the data to a MEGA-FIFO memory board, then you must use MemReadPretrig() to later read the pre-trigger data from the memory board. If you use MemRead(), the data will NOT be in the correct order. Every time this option is used, it overwrites any data already stored in the memory board. All data should be read from the board (with MemReadPretrig()) before collecting any new data. When this option is used, the memHandle parameter is ignored. The MEGA-FIFO memory must be fully populated in order to use the APretrig() method with the ExtMemory option. |
DTConnect | When the DtConnect option is used with this method the data from ALL A/D conversions is sent out the DT-Connect interface. While this method is waiting for a trigger to occur, it will send data out the DT-Connect interface continuously. If you have a Measurement Computing memory board plugged into the DT-Connect interface, then you should use the ExtMemory option rather than this option. |
For hardware trigger types, the buffer referenced by memHandle must be big enough to hold at least totalCount + 512 integers.