# FileAInScan()

Scans a range of A/D channels and stores the samples in a disk file. FileAInScan() reads the specified number of A/D samples at the specified sampling rate from the specified range of A/D channels from the board. If the A/D board has programmable gain, it sets the gain to the specified range.

The collected data is returned to a file in binary format. Use FileRead() to load data from that file into an array. Refer to board–specific information to determine if this method is supported on your device.

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function FileAInScan(ByVal lowChan As Integer, ByVal highChan As Integer, ByVal numPoints As Integer, ByRef rate As Integer, ByVal range As MccDaq.Range, ByVal fileName As String, ByVal options As MccDaq.ScanOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo FileAInScan(int lowChan, int highChan, int numPoints, ref int rate, MccDaq.Range range, string fileName, MccDaq.ScanOptions options)

## Parameters

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 with both single ended and differential inputs, the maximum allowable channel number also depends on how the board is configured (for example, eight channels for differential, 16 for single ended).

numPoints

Specifies the total number of A/D samples that will be collected. If more than one channel is being sampled, the number of samples collected per channel is equal to Count / (HighChan – LowChan + 1).

rate

Sample rate in samples per second (Hz) per channel. The maximum sampling rate depends on the A/D board that is being used (refer to the rate description in AInScan()).

range

If the selected A/D board does not have a programmable range feature, this parameter is ignored. Otherwise set the range parameter to any range that is supported by the selected A/D board. Refer to board-specific information in the Universal Library User's Guide 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. Set it to one of the constants in the options parameter values section below.

## Returns

- An ErrorInfo object that indicates the status of the operation.
- rate – actual sampling rate.

### options parameter values

All of the options settings are MccDaq.ScanOptions enumerated constants. To set a variable to one of these constants, refer to the MccDaq object and the ScanOptions enumeration (for example, variable = MccDaq.ScanOptions.ExtClock, variable = MccDaq.ScanOptions.ExtTrigger, and so on).

ExtClock | If this option is used, conversions are controlled by the signal on the external clock input rather than by the internal pacer clock. Each conversion is triggered on the appropriate edge of the trigger input signal (see board specific info). Additionally, the Rate parameter is ignored. The sampling rate is dependent on the trigger signal.
ExtTrigger | If this option is specified, the sampling does not begin until the trigger condition is met. On many boards, this trigger condition is programmable (refer to the SetTrigger() method and board–specific info for details) and can be programmed for rising or falling edge or an analog level. On other boards, only polled gate triggering is supported. Assuming active high operation, data acquisition commences immediately if the trigger input is high. If the trigger input is low, acquisition is held off until it goes high. Acquisition continues until numPoints samples are taken, regardless of the state of the trigger input. For polled gate triggering, this option is most useful if the signal is a pulse with a very low duty cycle (trigger signal is in a TTL low state most of the time) to hold off triggering until the pulse occurs.
DtConnect | Samples are sent to the DT-Connect port if the board is equipped with one.

## Notes

- OverRun error - (Error code 29) This error indicates that the data was not written to the file as fast as the data was sampled. Consequently some data was lost. The value returned from FileGetInfo() in totalCount is the number of points that were successfully collected.

## Important!

In order to understand the methods, read the board-specific information in the Universal Library User's Guide and also in the ReadMe files installed with the Universal Library. We also urge you to examine and run one or more of the example programs supplied prior to attempting any programming of your own. Following this advice may save you hours of frustration, and wasted time.

This note, which appears elsewhere, is especially applicable to this method. Now is the time to read the board-specific information for your board. We suggest that you make a copy of that page to refer to as you read this manual and examine the example programs.