# WriteSerial

Writes a text string out to the specified serial port whenever the spreadsheet is updated.

Note:

- The selected serial port must be configured for Text mode, and the In-Sight vision system must be Online. For more information, see WriteSerial.
- In-Sight Micro 1000 series vision systems only support serial communication when connected to the CIO-MICRO or CIO-MICRO-CC I/O module.
- There are two options for enabling serial communication for the In-Sight 70xx - 74xx series vision system: using the Breakout cable or using the CIO-MICRO or CIO-MICRO-CC I/O module. When connected to the Breakout cable (and there is no connection to an I/O module), the vision system allows one discrete input line and one discrete output line to be configured as Serial Receive and Serial Transmit, respectively.
- In-Sight 8000 series vision systems only support serial communication when connected to the CIO-MICRO I/O module.
- The CIO-WENET Ethernet I/O module does not support serial communication.

- In job deployment environments where In-Sight Explorer or the VisionView application are monitoring inspections, if the job depends on a Soft Event (e.g., configured as a Timer function) to trigger a spreadsheet event, it may cause the inspection of an image to be delayed if it is triggered shortly before the acquisition cycle completes. If the job file is large (i.e., it contains many Vision Tools, such as Pattern Match, Flaw Detection or InspectEdge tools, in addition to other job logic), the update required by In-Sight Explorer or VisionView may prevent an image from being inspected until the display update is queued. For applications that require exact timing (e.g., measured in the 10s of milliseconds), this update might delay the determination of pass/fail results and the transmission of results to the next station (e.g., a PLC or motion controller) in the inspection process. To avoid delayed inspections in these application environments, Cognex recommends Soft Events not be used.

- 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.

## WriteSerial Inputs

Syntax: WriteSerial(Event,Port,String)

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 A1. A cell containing an Event function. A cell containing a Button function. 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 vision systems. Can be 0 or 1 for an In-Sight emulator.
String | Specifies the text string to be written or a reference to a cell containing the text.

## WriteSerial Outputs

Returns | The text string to be written or #ERR if either input parameter is invalid.