# WriteDiscrete

Writes a range of bits to a discrete output channel.

Note: Discrete output functions can only run when the vision system is Online.
Inputs

The WriteDiscrete 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. has the following syntax:

WriteDiscrete(Event, StartBit, Number of Bits)

See the table for a description of the available parameters.

Parameter | Description
Event | Specifies the event that forces an update. This parameter needs to refer to any event with a timestamp, for example, one of the following: A cell containing an Event function. A cell containing a Button function.
Start Bit | Specifies the first bit of the set. The value of this parameter varies: The maximum allowed value varies depending on hardware and the number of output lines: In-Sight L38: 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 output lines. Based on the hardware, the maximum allowed bit is the following: In-Sight L38: 4 The Start Bit also limits the maximum value of the Number of Bits.
Value | Specifies the positive integer value. The maximum value depends on the number of written bits. The value is the converted decimal value of the binary value of the written bits.
Override Output Delay | When checked, the function overrides the Output Delay setting defined in the Discrete I/O Settings dialog, if any. Note: The function can only override the Output Delay setting if it is already enabled. If Output Delay is disabled in the Discrete I/O Settings dialog, the function returns an error when trying to override the setting.
Output Delay (ms) | Defines the output delay in milliseconds.

Outputs

Returns | The value written, #ERR for any invalid input parameter.