WriteDeviceNet

Writes data from a cell out to a DeviceNet Interface Module attached to the serial port of an In-Sight sensor.

Note:
  • The selected serial port must be configured for DeviceNet communications, and the In-Sight vision system must be Online. For more information, see Serial Port Settings Dialog.
  • Jobs containing this function that are saved in In-Sight Explorer 3.3.0 or higher are only compatible with In-Sight Explorer 3.3.0 and higher.
  • DeviceNet is only available on In-Sight vision systems using In-Sight firmware 4.x.x, and is not available on In-Sight vision systems running In-Sight firmware 5.1.0 and later. For a complete list of models and supported firmware versions, see Firmware Versions .
  • WriteDeviceNet will halt the execution of acquisition and spreadsheet functions if the serial port's internal buffer is full. WriteDeviceNet will resume spreadsheet operations as data is read out from the buffer and the buffer is emptied.
  • The WriteDeviceNet function requires a third-party RS-232-to-DeviceNet Gateway adapter. This function is available for legacy installations and should not be used in new applications, unless the RS-232-to-DeviceNet Gateway converter has been thoroughly tested to verify it is suitable for the application.

WriteDeviceNet Inputs

Syntax: WriteDeviceNet(Event,Port,MapSpec,Compatibility,Value1,[Value2,...])

Parameter Description

Event

Specifies the event that forces an update.This parameter must be a reference to one of the following:
  • The Image data structure in cell A0, containing the AcquireImage function. For more information, see AcquireImage.
  • A cell containing an Event function. For more information, see Event.
  • A cell containing a Button function. For more information, see Button.
Note: When the default Event reference is deleted, the value is replaced by a checkbox. If another cell is referenced as an event, the function will conditionally run based on the referenced cell. If the checkbox is enabled, the function will always run when any inputs to the function are updated.

Port

Specifies the serial port to be written. Must be 1 for In-Sight sensors. Can be 0 or 1 for an In-Sight emulators.

MapSpec

Specifies a data mapping (DataMap), which consists of a list of specifiers delimited by colon (:) characters. Each specifier has two parts: the starting byte and a data type code. The various data type codes are listed in the following table:

Code Data Type

i

8-bit integer

u

8-bit unsigned integer

il

16-bit integer

ul

16-bit unsigned integer

f

32-bit floating-point number

s

Text string

Example: "0i:1f:5u:6s" specifies that the first data item (at offset 0) is an 8-bit integer, which triggers an acquisition if non-zero; the second item (at offset 1) is a floating-point value; the third (at offset 5) is a 1-byte unsigned integer; and the rest of the packet (starting at offset 6) is a string.

Note: The length of the data must match the DeviceNet block size specified in the DeviceNet details. For more information, see Serial Port Settings Dialog.

Compatibility

Specifies whether an In-Sight 1000 sends an outgoing byte stream in the same order as an In-Sight 3000. This parameter is ignored for all other In-Sight models.

  • 0 = Compatibility Off
  • 1 = Compatibility On

Value

Specifies a variable length list of values consistent with the MapSpec (Value1, Value2, ...).

WriteDeviceNet Outputs

Returns

#ERR on invalid input parameter.