IO Sample Method (FPGA Interface)

CompactRIO Reference and Procedures (FPGA Interface)

Edition Date: June 2010

Part Number: 370984T-01

»View Product Info

This module method acquires a single sample from the module. The channel number, terminal mode, and voltage range are all configurable at run time. You use this module method by selecting it in an FPGA I/O Method Node that is configured for the appropriate device and/or channel. Details Examples

Note  National Instruments suggests that you do not configure the VI to run an IO Sample method and another FPGA I/O Method Node in parallel when both are targeted to the same C Series module. Similarly, National Instruments suggests that you do not configure the VI to run multiple IO Sample methods in parallel when the IO Sample methods are targeted to the same C Series module.
Configuration [i+2] contains encoded configuration information that gets loaded into the module conversion pipeline. This configuration information controls the data to be sampled two iterations into the future. Refer to the Conversion Timing topic for more information. Refer to the Configuration Encoding table below for an example of how the configuration information is encoded.
Data [i] Returns the data from the current sample.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error code number identifying an error. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source always contains an empty string because strings are not supported in LabVIEW FPGA.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error code number identifying an error. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source always contains an empty string because strings are not supported in LabVIEW FPGA.

Configuration Encoding Table

The following table describes how to construct the Configuration [i+2] value to write to the IO Sample method to perform a particular operation. The Operation column lists the types of operations that can be performed using the IO Sample method. The Configuration Bit Fields column lists the bit positions within the Configuration [i+2] number that need to be set. The Values column specifies the binary value to apply to the specified Configuration Bit Fields.

Operation Configuration Bit Fields Values
AI Read 15:13 001b
12:11 01b for channels 0-15
10b for channels 16-31
10:8 000b for channels 0, 8, 16, or 24
001b for channels 1, 9, 17, or 25

110b for channels 6, 14, 22, or 30
111b for channels 7, 15, 23, or 31
7:600b
5:4 00b for NRSE mode
11b for RSE or DIFF modes
3:2 11b for channels 8-15 or 24-31
01b for DIFF mode on channels 0-7 or 16-23
10b for RSE or NRSE mode on channels 0-7 or 16-23
DI0 Read 15:0 0000000000000000b
DO0 Write 15:1 010000000000000b
0 Binary value to write to DO0

Using This Method

The IO Sample method provides an efficient and flexible interface to the module. You can use this method to acquire a single sample from any of the channels on the module, at any range, and with any available input mode.

When this method is executed, the module performs a single conversion on the next channel present in the conversion pipeline on the module. The data from this conversion is returned via the Data [i] method output. At the same time that the conversion data is read from the module, the new configuration information specified by the Configuration [i+2] input is loaded into the configuration pipeline on the module. The pipeline is two samples deep. So, the configuration information specified on one execution of the IO Sample method determines which channel will be sampled by the IO Sample method two iterations into the future. Refer to the Conversion Timing topic for more details.

Examples

Refer to the NI 9205 Basic IO VI and the NI 9205 Advanced IO VI in the labview\examples\CompactRIO\Module Specific\NI 9205\NI 9205 Basic IO\NI 9205 Basic IO.lvproj and labview\examples\CompactRIO\Module Specific\NI 9205\NI 9205 Advanced IO\NI 9205 Advanced IO.lvproj for examples of the IO concepts discussed above.

(NI 9205 Basic IO)

(NI 9205 Advanced IO)

WAS THIS ARTICLE HELPFUL?

Not Helpful