AI 驱动文档
您想了解什么?
PLC 通信细节(EtherNet/IP)
OV20i 视觉系统支持与基于 EtherNet/IP 的 PLC 实时通信。本指南解释如何配置循环 I/O 连接、映射数据结构,以及使用 Overview 的 Node-RED 工具访问全局检测结果和 ROI 级检测结果。
请参阅本主题的实际演示:Auto-Integration Builder
如需基本连接说明,请参阅 连接到 PLC(EtherNet/IP、PROFINET).
概览
OV20i 作为 EtherNet/IP 适配器,而您的 PLC 作为扫描器(或主站)。一旦配置完成,设备将以紧凑且可预测的格式在每个循环中交换结构化数据。
支持的功能
- 循环 I/O 通信 - 支持 20–10,000 ms 的循环时间
- 数据吞吐量 - 双向最多 256 字节
- 自定义数据处理 - 将 Node-RED 数据作为活动配方的一部分进行读写
输入汇编(OV20i → PLC)
输入汇编包含每个循环中从 OV20i 发送到 PLC 的数据。内容包括系统状态、检测结果、配方信息,以及可选的 ROI 分解。

输出汇编(PLC → OV20i)
输出汇编包含从 PLC 发送到 OV20i 的控制数据。可用于触发检测、修改配方,或传入自定义参数。

时序与握手行为

自定义数据支持
OV20i 可以作为 Node-RED 流的一部分接收或返回附加自定义数据。
PLC → OV20i
- 写入外部标志、阈值或计数器以影响 Node-RED 中的逻辑
OV20i → PLC
- 返回计算值、测量值、时间戳或条件输出
自定义数据位于汇编的扩展部分,从核心信号和配方信息之后开始。
ROI 结果分解(仅限 Classification 配方)
对于分类配方,您可以使用 Overview 的自定义 Node-RED 节点:Format data for PLC,将每个 ROI 的结果暴露给 PLC。
工作原理:
- 置于 Node-RED 流中的 All Blocks Output Data 与 Send Data to PLC 之间

-
自动填充从输入汇编的字节 16 开始的结构化 ROI 区域
-
每次检测最多支持 4 个 ROI
-
每个 ROI 包含:
- ROI ID
- 通过/不通过 位
- 置信度分数
- 供将来使用的保留字节
Format Data for PLC 节点仅适用于 Classification 配方。

Default PLC Tag Reference
This section provides a complete reference of every tag in the Input and Output assemblies, including byte offsets, bit positions, data types, and default values. Use this as the definitive bit map when configuring your PLC program.
Where to View Default Tags in the Camera UI
- Open the OV20i web interface (e.g.,
http://192.168.1.100). - Navigate to 工业以太网 in the left sidebar.
- Select your active protocol (EtherNet/IP or PROFINET).
- The page displays the current assembly configuration, including input/output data sizes and the connection status.
- The default tag layout shown on this page corresponds to the tables below.
Input Assembly Tags (OV20i → PLC)
These tags are read by the PLC. The camera writes them every I/O cycle.
Byte 0 -- Status Flags
| Bit | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 0 | I.Data[0].0 | Trigger Ready | BOOL | Camera is ready to accept a trigger. Must be HIGH before sending a trigger request. | 0 (goes HIGH after startup) |
| 1 | I.Data[0].1 | Trigger Acknowledge | BOOL | Camera has received and accepted the trigger request. | 0 |
| 2 | I.Data[0].2 | Recipe Switch Acknowledge | BOOL | Camera has received and completed the recipe switch request. | 0 |
| 7 | I.Data[0].7 | Online / Startup Complete | BOOL | Camera has finished booting and is online. | 0 (goes HIGH after boot) |
Byte 1 -- Error and Status Flags
| Bit | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 0 | I.Data[1].0 | Trigger Error | BOOL | An error occurred during the trigger cycle. Latched until cleared. | 0 |
| 1 | I.Data[1].1 | Recipe Switch Error | BOOL | An error occurred during recipe switching. Latched until cleared. | 0 |
| 6 | I.Data[1].6 | Busy | BOOL | Camera is currently processing (inspection running or recipe switching). Do not send new commands while HIGH. | 0 |
Byte 2 -- Inspection Result Flags
| Bit | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 0 | I.Data[2].0 | Exposure Complete | BOOL | Image exposure has completed. | 0 |
| 1 | I.Data[2].1 | Inspection Completed / Result Available | BOOL | Inspection processing is finished and results are valid. | 0 |
| 2 | I.Data[2].2 | Inspection Pass | BOOL | Final pass/fail result. HIGH = Pass, LOW = Fail. Only valid when Result Available is HIGH. | 0 |
Bytes 3--7 -- Reserved
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 3 | I.Data[3] | Reserved | BYTE | Reserved for future use. | 0x00 |
| 4 | I.Data[4] | Reserved | BYTE | Reserved for future use. | 0x00 |
| 5 | I.Data[5] | Reserved | BYTE | Reserved for future use. | 0x00 |
| 6--7 | I.Data[6]--I.Data[7] | Reserved | BYTE | Reserved for future use. | 0x00 |
Bytes 8--9 -- Current Recipe ID
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 8--9 | I.Data[8]--I.Data[9] | Current Recipe ID | UINT (16-bit) | 当前活动配方的 ID。与 O.Data[4] 比较以验证配方切换已完成。 | 0 |
Bytes 10--11 -- Reserved
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 10--11 | I.Data[10]--I.Data[11] | Reserved | BYTE | Reserved for future use. | 0x00 |
Bytes 12--13 -- Inspection ID
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 12--13 | I.Data[12]--I.Data[13] | Inspection ID | UINT (16-bit) | 随每次检测递增的滚动式 16 位计数器。用于将结果与特定触发器关联。 | 0 |
Bytes 14--15 -- Reserved
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 14--15 | I.Data[14]--I.Data[15] | Reserved | BYTE | Reserved for future use. | 0x00 |
Bytes 16--256 -- ROI Results Assembly / Custom Data from Node-RED
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 16--256 | I.Data[16]--I.Data[256] | ROI Results / Custom Data | BYTE[] | 当使用 "Format Data for PLC" Node-RED 块时,此区域将填充结构化的 ROI 结果。否则可用于 Node-RED 流中的自定义数据。 | 0x00 |
Output Assembly Tags (PLC → OV20i)
这些标签由 PLC 写入。相机在每个 I/O 循环中读取它们。
Byte 0 -- Control Flags
| Bit | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 0 | O.Data[0].0 | Trigger Request | BOOL | 将 HIGH 设置为触发一次检査。锁存直到 Trigger Acknowledge (I.Data[0].1) 拉高,然后解除锁存。 | 0 |
| 1 | O.Data[0].1 | Recipe Switch Request | BOOL | 将 HIGH 设置为请求切换配方到 O.Data[4] 中的 ID。锁存直到 Recipe Switch Ack (I.Data[0].2) 拉高,然后解除锁存。 | 0 |
Bytes 1--3 -- Reserved
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 1 | O.Data[1] | Reserved | BYTE | Reserved for future use. | 0x00 |
| 2 | O.Data[2] | Reserved | BYTE | Reserved for future use. | 0x00 |
| 3 | O.Data[3] | Reserved | BYTE | Reserved for future use. | 0x00 |
Bytes 4--5 -- Recipe ID
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description | Default Value |
|---|---|---|---|---|---|
| 4--5 | O.Data[4]--O.Data[5] | Recipe ID | UINT (16-bit) | 要切换到的配方 ID。在设置 Recipe Switch Request 位之前,请在此处写入所需的配方编号。 | 0 |
字节 6--256 -- Node-RED 的自定义数据
| 字节 | PLC 标签地址 | 标签名称 | 数据类型 | 描述 | 默认值 |
|---|---|---|---|---|---|
| 6--256 | O.Data[6]--O.Data[256] | Node-RED 的自定义数据 | BYTE[] | Node-RED 流可读取的用户自定义数据。可在此区域传递序列号、阈值、部件 ID,或任何其他要传递给摄像头的参数。 | 0x00 |
位映射图
以下基于文本的图表展示两个组件的完整字节/位布局。每行表示一个字节(或一个字节范围),每列表示一个位位置(左侧为位 7,右侧为位 0)。
输入组件位映射(OV20i → PLC)
Byte │ Bit 7 │ Bit 6 │ Bit 5 │ Bit 4 │ Bit 3 │ Bit 2 │ Bit 1 │ Bit 0
─────┼────────────────┼────────┼───────┼───────┼───────┼────────────────────┼────────────────────────────┼──────────────────
0 │ Online/Startup │ --- │ --- │ --- │ --- │ Recipe Switch Ack │ Trigger Ack │ Trigger Ready
│ Complete │ │ │ │ │ │ │
─────┼────────────────┼────────┼───────┼───────┼───────┼────────────────────┼────────────────────────────┼──────────────────
1 │ --- │ Busy │ --- │ --- │ --- │ --- │ Recipe Switch Error │ Trigger Error
─────┼────────────────┼────────┼───────┼───────┼───────┼────────────────────┼────────────────────────────┼──────────────────
2 │ --- │ --- │ --- │ --- │ --- │ Inspection Pass │ Inspection Completed / │ Exposure
│ │ │ │ │ │ │ Result Available │ Complete
─────┼────────────────┼────────┼───────┼───────┼───────┼────────────────────┼────────────────────────────┼──────────────────
3-5 │ --- │ --- │ --- │ --- │ --- │ --- │ --- │ ---
─────┼────────────────┼────────┼───────┼───────┼───────┼────────────────────┼────────────────────────────┼──────────────────
6-7 │ Reserved │
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
8-9 │ Current Recipe ID (16-bit unsigned integer) │
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
10-11│ Reserved │
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
12-13│ Inspection ID (16-bit unsigned integer) │
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
14-15│ Reserved │
─────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
16- │ ROI Results Assembly or Custom Data from Node-RED │
256 │ │
输出组装位图(PLC → OV20i)
Byte │ Bit 7 │ Bit 6 │ Bit 5 │ Bit 4 │ Bit 3 │ Bit 2 │ Bit 1 │ Bit 0
─────┼───────┼───────┼───────┼───────┼───────┼───────┼───────────────────────┼────────────────
0 │ --- │ --- │ --- │ --- │ --- │ --- │ Recipe Switch Request │ Trigger Request
─────┼───────┼───────┼───────┼───────┼───────┼───────┼───────────────────────┼────────────────
1-3 │ Reserved │
─────┼──────────────────────────────────────────────────────────────────────────────────────────
4-5 │ Recipe ID (16-bit unsigned integer) │
─────┼──────────────────────────────────────────────────────────────────────────────────────────
6- │ Custom Data for Node-RED │
256 │ │
ROI Results Assembly Detail (Bytes 16--55)
当使用带有 classification recipes 的 Format Data for PLC Node-RED 块时,Input Assembly 的字节 16 及以上将填充结构化的对齐器数据和每个 ROI 的数据,具体如下:
对齐器部分(Bytes 16--23)
| Byte(s) | PLC Tag Address | Tag Name | Data Type | Description |
|---|---|---|---|---|
| 16, bit 0 | I.Data[16].0 | Aligner Success | BOOL | HIGH 若对齐器已成功定位到工件。 |
| 17--18 | I.Data[17]--I.Data[18] | Aligner Confidence | UINT (16-bit) | 对齐的置信度分数(0--65535)。 |
| 19--20 | I.Data[19]--I.Data[20] | Aligner Angle | INT (16-bit, signed) | 相对于模板的匹配角度。 |
| 21--23 | I.Data[21]--I.Data[23] | Reserved (Aligner) | BYTE | 为未来对齐器数据保留。 |
ROI 结果块(Bytes 24--55)
每个 ROI 占用 8 字节。最多支持 4 个 ROI(ROI 0 至 ROI 3)。
ROI 区块结构(每 8 字节重复一次):
| Offset within block | Tag Name | Data Type | Description |
|---|---|---|---|
| +0 | ROI ID | UINT8 (8-bit) | ROI 的唯一数字标识符。 |
| +1, bit 0 | ROI Pass | BOOL | HIGH = 此 ROI 通过,LOW = 此 ROI 失败。 |
| +2 to +3 | ROI Confidence | UINT (16-bit) | 此 ROI 分类的置信度分数(0--65535)。 |
| +4 to +7 | Reserved | BYTE | 为将来每个 ROI 的数据保留。 |
ROI 起始地址:
| ROI | Start Byte | PLC Address Range | ID Address | Pass Address | Confidence Address |
|---|---|---|---|---|---|
| ROI 0 | 24 | I.Data[24]--I.Data[31] | I.Data[24] | I.Data[25].0 | I.Data[26]--I.Data[27] |
| ROI 1 | 32 | I.Data[32]--I.Data[39] | I.Data[32] | I.Data[33].0 | I.Data[34]--I.Data[35] |
| ROI 2 | 40 | I.Data[40]--I.Data[47] | I.Data[40] | I.Data[41].0 | I.Data[42]--I.Data[43] |
| ROI 3 | 48 | I.Data[48]--I.Data[55] | I.Data[48] | I.Data[49].0 | I.Data[50]--I.Data[51] |
缓冲配置
在 Camera UI 中查看默认标签
默认标签布局由摄像机固件定义,并对应上方表格。要查看当前配置:
- 打开 OV20i 的网页界面。
- 在左侧菜单中选择 Industrial Ethernet。
- 选择你的协议(EtherNet/IP 或 PROFINET)。
- 页面显示:
- 连接状态与设备信息
- 输入与输出组装大小(双向最高 256 字节)
- EDS 或 GSDML 文件下载链接(也编码了默认的组装结构)
EDS 文件(用于 EtherNet/IP)和 GSDML 文件(用于 PROFINET)均定义默认数据大小。当你在 Studio 5000 或 TIA Portal 中添加摄像头模块时,这些描述符文件中的组装大小决定每个循环交换的字节数。
创建自定义数据缓冲区
要在摄像头与 PLC 之间发送自定义数据(超出默认状态/结果标签),请使用 "Format Data for PLC" Node-RED 块:
- 从摄像头网页界面打开 Node-RED(进入 Node-RED 编辑器)。
- 在你的配方流程中,将 "Format Data for PLC" 节点放在 "All Blocks Output Data" 节点与 "Send Data to PLC" 节点之间。
- 配置字节序:
- 对 Allen-Bradley / Rockwell PLCs 使用 Little-endian
- 对 Siemens PLCs 使用 Big-endian
- 该块会自动把分类 ROI 结果格式化为从 Input Assembly 的字节 16 开始的结构化布局(参见上方 ROI Results Assembly Detail 小节)。
对于完全自定义的数据缓冲区(不使用默认 ROI 格式):
- 在你的 Node-RED 流中,使用一个 Function 节点来构造一个
msg.payload缓冲区,其字节布局符合你的需求。 - 将其连接到 "Send Data to PLC" 节点。
- 你的自定义字节将从字节 16 开始填充 Input Assembly。
- PLC 端读取相应的
I.Data[16]至I.Data[256]地址。
更改标签分配
核心标签(Input Assembly 的字节 0--15 与 Output Assembly 的字节 0--5)由摄像机固件固定,不能重新分配。这些是系统级信号(触发、配方开关、状态、错误、配方 ID,以及 inspection ID)。
可配置区域是:
- Input Assembly bytes 16--256:由 Node-RED 填充。你可以通过配置 Node-RED 流来控制这里的数据。默认情况下,"Format Data for PLC" 块使用 ROI 结果填充此区域,或者你可以使用 Function 节点写入任意数据。
- Output Assembly bytes 6--256:由 Node-RED 读取。你可以将 PLC 的任意数据写入这些字节,然后在你的 Node-RED 流中使用相应的输入节点读取它们。这对于从 PLC 发送序列号、批次 ID、阈值或其他参数到摄像头非常有用。
将来自 PLC 的自定义数据发送到摄像头 (Output Assembly)
要把来自 PLC 的自定义数据传递到 Node-RED:
- 在 PLC 程序中,将数值写入
O.Data[6]至O.Data[256]。 - 在摄像头的 Node-RED 中,使用 PLC 输入数据节点读取这些字节。
- 在你的流程逻辑中使用这些数值(例如阈值、序列号、条件参数)。
快速参考:标签地址速查表
下表汇总了在 PLC 编程中最常用的标签,便于快速查找:
| PLC 地址 | 方向 | 信号名称 | 用途 |
|---|---|---|---|
I.Data[0].0 | 相机 → PLC | 触发就绪 | 触发前检查 |
I.Data[0].1 | 相机 → PLC | 触发确认 | 此信号变 HIGH 时解除触发锁定 |
I.Data[0].2 | 相机 → PLC | 配方切换确认 | 此信号变 HIGH 时解除配方请求 |
I.Data[0].7 | 相机 → PLC | 在线/启动完成 | 确认相机已启动 |
I.Data[1].0 | 相机 → PLC | 触发错误 | 监控触发故障 |
I.Data[1].1 | 相机 → PLC | 配方切换错误 | 监控配方切换故障 |
I.Data[1].6 | 相机 → PLC | 忙 | HIGH 时禁止发送命令 |
I.Data[2].0 | 相机 → PLC | 曝光完成 | 图像已捕获 |
I.Data[2].1 | 相机 → PLC | 结果可用 | 可安全读取通过/失败 |
I.Data[2].2 | 相机 → PLC | 检查通过 | HIGH = 通过,LOW = 失败 |
I.Data[8]--I.Data[9] | 相机 → PLC | 当前配方 ID | 切换后验证配方 |
I.Data[12]--I.Data[13] | 相机 → PLC | 检查 ID | 将结果与触发器相关联 |
O.Data[0].0 | PLC → 相机 | 触发请求 | 拉高锁存以触发 |
O.Data[0].1 | PLC → 相机 | 配方切换请求 | 拉高锁存以切换配方 |
O.Data[4]--O.Data[5] | PLC → 相机 | 配方 ID | 设置期望的配方编号 |
O.Data[6]+ | PLC → 相机 | 自定义数据 | Node-RED 的用户定义数据 |
I.Data[16]+ | 相机 → PLC | ROI 结果 / 自定义数据 | ROI 结果或自定义 Node-RED 输出 |