# ReadDiscrete

Note: This function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. is currently not supported on In-Sight L38 series Vision Systems.

Reads a range of bits from a discrete input channel.

Inputs

The ReadDiscrete function has the following syntax:

ReadDiscrete(Event, StartBit, Number of Bits)

See the table for a description of the available parameters.

Parameter | Description
Event | Specifies the update event on which to read.
Start Bit | Specifies the first bit of the set. The value of this parameter varies: The default value is 1. You cannot set the Start Bit to 0. The minimum allowed value is 1. The maximum allowed value varies depending on hardware and the number of input lines: In-Sight 2800: 3 In-Sight 3800: 3
Number of Bits | Specifies the number of bits in the set. The value of this parameter varies: The default value is 1. The minimum allowed value is 1. The maximum allowed value varies depending on hardware and the number of input lines: In-Sight 2800: 3 In-Sight 3800: 3 The Start Bit also limits the maximum value of the Number of Bits.

Note: You can configure Discrete I/O lines to be either an input or output, which affects the maximum values for Start Bit and Number of Bits.
Outputs

Returns | The positive integer value read, or #ERR. The Start Bit and Number of Bits must fall within the range of input bits, or the function returns #ERR. The value is the converted decimal value of the binary value of the bits that are read.