# LPPLC 设备文档站(lpplc.cn/wiki) > 给 AI 的总入口。本站是 LPPLC 系列 PLC / DTU / 软 PLC 模拟器的**客户说明书**,覆盖梯形图、Lua 二次开发、DTU 配置式采集、上位机工具、WEB 云组态、私有化服务器对接。客户把本站网址交给 AI、要求"照我的设备写一段程序"时,应当以本文件为起点,不要凭记忆作答。 - 站点:https://lpplc.cn/wiki/ - 页面总数:460;板块数:9 - 机型清单(本站正文出现过的型号):LP1616 / LP2222MR / LP2222MT / LP2229MT / LP2250MR / LP2250MT / LP2252MR / LP2252MT / LP2300 / LP2323 / LP3201 / LP3202 / LP3203 / LP3205 / LP3222 / LP3232 / LP3288 / LP6666 / LP8802 / LP8910 / LP8911 / LP8912 / LP8913 / LP8915 / LP8916 / LP8922 / 上位机 / 上位机(`utf8`/`debug`/`package` 各机型均可用) / 定制版 / 软PLC模拟器 - 语料接口(已按小节切块、每块自带出处,适合直接做检索):https://lpplc.cn/wiki/lp-kb/manifest.json - 完整索引(含每页小节锚点,JSON):https://lpplc.cn/wiki/llms-index.json - 全量正文(一次抓全站,含每页完整内容):https://lpplc.cn/wiki/llms-full.txt ## 抓这个站之前先看清地址(这一节是照着踩坑记录写的) - **文档只在 `/wiki/` 下面。** `https://lpplc.cn/`(不带 `/wiki/`)是云组态 Web 应用,那是一个真正的 Vue 单页应用:整页只有 `
` 空壳,去标签后可见正文 0 字。抓到那种页面**不是本站没内容**,是走错了地址。 - **页面地址必须带 `.html`。** 本站 VitePress 配的是 `cleanUrls:false`,去掉 `.html` 或改成 `.md` 会被前面的 linpan 服务器直接回一条 404(67 字节、GBK 编码,UTF-8 抓过去是一串乱码)。上面每条链接都已带全 `.html`,请原样使用。 - **正文是服务端渲染的,抓一次就有。** 例如 OPC UA 那页 211KB 的 HTML 里,去掉标签后仍有 5675 个汉字的正文,`opcua.creat`、`add_poll`、`哪些平台能用` 这些字样都在原始 HTML 里,不需要执行 JavaScript。 - **一次抓不全很正常,别因此判定"内容是 JS 渲染的"。** 首页只有卡片导航,VitePress 也只渲染当前板块的侧边栏:从首页抓一次能看到 20 个页面链接(全站 460 页的一小部分)。要全量就用本页这份清单(下面「全部页面」列满 460 条),不要靠顺着链接爬。 ## 用本站知识写程序之前,这几条必须守住 1. **梯形图/IL 的应用指令只能照 [PLC 指令速查总表](https://lpplc.cn/wiki/plc/02-00-instruction-quickref.html) 写。** 那页逐条对过固件源码与三菱 FX3U 官方 FNC 表(手写维护),每一行的示例写法与步数都过过上位机编码器(`npm run check:quickref-il`),照示例列敲就能编进。「位宽」列直接给这条按 16 位还是 32 位处理数据:`16 位` 的指令另有一条 32 位版(助记符带 `D`,就在下一行),`32 位(无 16 位版)` 是浮点/三角/高速比较那一族(只有这一个名字,前面不要再加 `D`),`—` 是触点线圈类基本指令。注意 `DRVI`/`DRVA`/`DIS`/`DSW`/`DUTY` 名字带 `D` 但本身就是 16 位。「状态」列会指出两种写了也不生效的情形:**上位机指令表里根本没有这个助记符**(面板列着、只作参考,敲了报「未知的应用指令」),以及能编进去但运行时无动作的占位指令。浮点与三角函数那一族(`SIN`/`EADD`/`ECMP` …)在本机只有 32 位一种形态,三菱印的名字就是表里这一列,前面不要再加 `D`(`DSIN`/`DEADD` 是编码器顺带接受的别名,编出来是同一条,但生成程序请照本表的名字写,见铁律 W-28)。表里没有的助记符不要凭三菱兼容资料编出来;每条的步数也在那页,算程序容量时用。 2. **没有标注机型的页面,不代表所有机型都支持。** 判断"这台能不能做 X"只看两处:Lua 各协议页的「哪些平台能用」小节,以及 [Lua API 速查表](https://lpplc.cn/wiki/lua/a-01-api-quickref.html) 里"仅 …… 固件支持"那一类行。其他机型上对应全局表根本不存在,脚本直接用会报 `attempt to index a nil value`。 3. **写 DDC(逻辑编程)程序时,块类型名、操作名和下拉框的取值只能照 [2.0 功能块速查总表](https://lpplc.cn/wiki/ddc/02-00-block-quickref.html) 和各块详解页写。** 那页每颗块都标了它在 `ddc.json` 里的类型名与生成的操作(op),下拉选项写成「年=year」这样的,等号后面那串才是文件里要填的值(`"part": "year"`、`"edge": "fall"`、`"mode": "on"`)——画布上只显示中文,照中文或凭同类语言习惯编出来的值会被编辑器判成「未知 …」。用到的块要串成什么形状,看各页的「形态」列和 [例程总览](https://lpplc.cn/wiki/ddc/b-00-example-overview.html) 那批可直接照抄的完整 JSON。 4. **函数签名以 API 速查表与模块页为准,找不到就明确说找不到。** 本站没有的函数不要凭同类语言的习惯编出来。 5. **脚本不靠主循环跑**:周期任务用 `timer.start(ms, fn)` 注册,脚本执行完固件会自动进入事件循环泵消息。**绝不要写 `while true do ... sleep(...) end`** —— 设备 Lua 是单线程事件循环,`sleep` 不泵消息队列,会让定时器 / MQTT / 串口回调**全部失效**(典型表现:MQTT 显示已连接,但收不到下发、也不上报)。另外脚本**下载后必须重启设备**才生效。正确写法见 [第一个 Lua 脚本](https://lpplc.cn/wiki/lua/01-06-first-script.html) 与 [综合例程:Modbus 采集 + MQTT 上报 + 云端下发](https://lpplc.cn/wiki/lua/b-01-modbus-mqtt.html)。 6. **同一件事常有"配置式 / 脚本式"两种做法**(例如 OPC UA 既能上位机点配置、也能 Lua 写脚本)。先问清客户要哪种,再给对应的页面;两种都写出来会让人以为只能选一种。 ## 常见任务 → 该按顺序读哪几页 > 本站是**参考手册**结构(按技术栈分章),不是一篇端到端教程;这张表补的就是"做一件事要串哪几页"。照着抄程序时,缺的胶水层(初始化顺序、定时器注册、下载后重启)请以这里列出的页面为准,不要自己补。 - **让 AI 帮我写程序,但本机没装模型也没有 API Key** → [10.10 用免费的大模型网页问(没装模型、也没有 API Key)](https://lpplc.cn/wiki/tool/10-10-ai-web-model.html) → [10.1 AI 编程助手](https://lpplc.cn/wiki/tool/10-01-ai-assistant.html) → [02-00-instruction-quickref](https://lpplc.cn/wiki/plc/02-00-instruction-quickref.html) → [API 速查表](https://lpplc.cn/wiki/lua/a-01-api-quickref.html) → [7.1 软 PLC 模拟器](https://lpplc.cn/wiki/tool/07-01-simulator.html) - **写一段梯形图程序(先确认哪些指令真能用)** → [02-00-instruction-quickref](https://lpplc.cn/wiki/plc/02-00-instruction-quickref.html) → [第一个梯形图程序](https://lpplc.cn/wiki/plc/01-03-first-ladder.html) → [梯形图基本概念](https://lpplc.cn/wiki/plc/01-04-ladder-basics.html) → [指令步数速查](https://lpplc.cn/wiki/plc/02-07-instruction-steps.html) → [基本回路例程](https://lpplc.cn/wiki/plc/b-01-basic-circuits.html) - **用 Lua 采一路 Modbus RTU 仪表并写进寄存器** → [第一个 Lua 脚本](https://lpplc.cn/wiki/lua/01-06-first-script.html) → [com — 串口通信](https://lpplc.cn/wiki/lua/06-01-com.html) → [com_modbus — 串口 Modbus 主站](https://lpplc.cn/wiki/lua/07-01-com-modbus.html) → [plc — PLC 数据交互](https://lpplc.cn/wiki/lua/04-01-plc.html) - **把采集数据送上云(不写代码,配置式)** → [1.2 串口设备采集](https://lpplc.cn/wiki/dtu/01-02-serial-acquisition.html) → [1.1 云交互数据点](https://lpplc.cn/wiki/dtu/01-01-cloud-datapoints.html) → [1.3 MQTT](https://lpplc.cn/wiki/dtu/01-03-mqtt.html) - **自己写代码上报云端 / MQTT** → [plc.cloud_* — 云平台通信](https://lpplc.cn/wiki/lua/12-01-cloud.html) → [mqtt — MQTT 客户端](https://lpplc.cn/wiki/lua/05-02-mqtt.html) → [json — JSON 编解码](https://lpplc.cn/wiki/lua/11-05-json.html) - **做 OPC UA 服务端给组态软件读** → [opcua — OPC UA](https://lpplc.cn/wiki/lua/10-02-opcua.html) → [2.2 OPC UA](https://lpplc.cn/wiki/dtu/02-02-opcua.html) - **用逻辑编程(拖方块)搭一段控制逻辑** → [01-02-first-program](https://lpplc.cn/wiki/ddc/01-02-first-program.html) → [02-00-block-quickref](https://lpplc.cn/wiki/ddc/02-00-block-quickref.html) → [基础控制例程](https://lpplc.cn/wiki/ddc/b-01-basic-control.html) → [03-01-download-run](https://lpplc.cn/wiki/ddc/03-01-download-run.html) - **梯形图和 Lua 混着用(谁负责什么)** → [PLC 与 Lua 协同](https://lpplc.cn/wiki/plc/06-04-plc-lua-coordination.html) → [plc — PLC 数据交互](https://lpplc.cn/wiki/lua/04-01-plc.html) → [Lua 脚本编程](https://lpplc.cn/wiki/lua/00-01-capability-overview.html) - **多台 PLC 互联 / 读写别人家的 PLC** → [pipe — 统一管道通信](https://lpplc.cn/wiki/lua/08-01-pipe-overview.html) → [pipe "mc" — 三菱 MC 协议](https://lpplc.cn/wiki/lua/08-02-pipe-mc.html) → [pipe 西门子 S7 系列](https://lpplc.cn/wiki/lua/08-04-pipe-s7.html) - **脚本写完怎么下载进设备、怎么确认生效** → [第一个 Lua 脚本](https://lpplc.cn/wiki/lua/01-06-first-script.html) → [7.1 软 PLC 模拟器](https://lpplc.cn/wiki/tool/07-01-simulator.html) → [常见问题](https://lpplc.cn/wiki/manual/faq/) - **跑起来不对,怎么查** → [常见问题](https://lpplc.cn/wiki/lua/a-02-faq.html) → [A. 常见问题与排查](https://lpplc.cn/wiki/dtu/a-01-faq-troubleshooting.html) → [API 速查表](https://lpplc.cn/wiki/lua/a-01-api-quickref.html) - **我手上这台是哪款、能用到哪些功能** → [机型总览](https://lpplc.cn/wiki/manual/models/) → [API 速查表](https://lpplc.cn/wiki/lua/a-01-api-quickref.html) → [01-03-protocol-guide](https://lpplc.cn/wiki/server/01-03-protocol-guide.html) ## 板块 - **manual**(使用说明):41 页 → https://lpplc.cn/wiki/manual/faq/ - **plc**(梯形图):78 页 → https://lpplc.cn/wiki/plc/ - **ddc**(图形化逻辑):82 页 → https://lpplc.cn/wiki/ddc/ - **lua**(脚本):94 页 → https://lpplc.cn/wiki/lua/ - **dtu**(配置):11 页 → https://lpplc.cn/wiki/dtu/ - **tool**(上位机操作):52 页 → https://lpplc.cn/wiki/tool/ - **scada**(组态编辑):59 页 → https://lpplc.cn/wiki/scada/ - **server**(私有化部署):42 页 → https://lpplc.cn/wiki/server/ - **总览**(导航):1 页 → https://lpplc.cn/wiki/ ## 全部页面 > 每行:`标题 — 一句话 — 地址`。要精确到小节,用 llms-index.json 里该页的 outline 拼 `#锚点`。 ### ddc - 01-01-open-editor — 用新版上位机工具连接设备后,进入**设备详情页**。顶部按钮排里有三个编程入口,按「逻辑编程 → 梯形图编辑器 → Lua 编辑器」排列,最左边的 **「逻辑编程」** 就是本板块的入口,点它打开逻辑编程编辑器窗口。 — https://lpplc.cn/wiki/ddc/01-01-open-editor.html - 01-02-first-program — 这一节用内置示例「温度控制(通风扇)」完整走一遍:打开示例 → 看懂程序 → 下发到设备 → 验证效果。全程不需要写一行代码。 — https://lpplc.cn/wiki/ddc/01-02-first-program.html - 02-00-block-quickref — 一页列全上位机「逻辑编程」编辑器的全部自带功能块:类型名、块面参数与连线端子、下发后生成的 ddc.json 操作、有无状态、详解页链接。 — https://lpplc.cn/wiki/ddc/02-00-block-quickref.html - 02-01-program-blocks — 程序类功能块是程序的「骨架」:规定什么时候执行、按什么顺序执行、结果写给谁。 — https://lpplc.cn/wiki/ddc/02-01-program-blocks.html - 02-02-data-blocks — 数据类功能块负责「取数」——把寄存器里的值、设定的常数、设备时钟取出来,供其他方块使用。 — https://lpplc.cn/wiki/ddc/02-02-data-blocks.html - 02-03-logic-blocks — 逻辑类功能块产出「真 / 假」(1 / 0)或「满足 / 不满足」的判断结果, — https://lpplc.cn/wiki/ddc/02-03-logic-blocks.html - 02-04-math-blocks — 计算类功能块对数值做加工:算术运算、限幅、量程换算、位处理、累计时间等。 — https://lpplc.cn/wiki/ddc/02-04-math-blocks.html - 02-05-hvac-blocks — HVAC 类功能块是给暖通空调项目准备的现成算法,不用自己搭公式。 — https://lpplc.cn/wiki/ddc/02-05-hvac-blocks.html - 02-06-display-module — 显示模块用来**给设备做一块屏**:把温度、频率、运行状态这些数字组织成现场人员看得懂、按得动的画面——第一行「送风温度 26.5℃」,第三行「运行模式 停止」,第四行按进去就是「参数设置」。 — https://lpplc.cn/wiki/ddc/02-06-display-module.html - 03-01-download-run — 这一节说明程序从画布到设备之后是怎么运行的:存哪里、什么时候跑、和梯形图 / Lua 脚本是什么关系、改程序后会发生什么。 — https://lpplc.cn/wiki/ddc/03-01-download-run.html - 03-02-faq — 超出限制时不用记数字——点「生成 JSON」后右侧「问题」列表会直接给出中文提示(如「定时循环最多 3 个」)。 — https://lpplc.cn/wiki/ddc/03-02-faq.html - 04-01-custom-blocks — 前面 2.1 程序类~2.6 显示模块 讲的都是工具**自带**的功能块,它们解决的是通用需求。**自定义功能块**解决的是「您自己的专属工艺」:把一段反复使用、或者体现您调试经验的计算 / 判断逻辑,用一小段 Lu… — https://lpplc.cn/wiki/ddc/04-01-custom-blocks.html - 04-02-first-custom-block — 这一节跟着做一遍,从零做出一个能用的块,大约 10 分钟。**例子目标**:做一个「比例器」——把接进来的测量值乘以一个比例系数,结果送到指定寄存器。它有 1 个输入、1 个参数、1 个输出,是最简单也最典型的结构。 — https://lpplc.cn/wiki/ddc/04-02-first-custom-block.html - 04-03-lua-interface — 这一节把自定义块里 Lua 的写法讲透。只要记住「**一个固定骨架 + 一张 I 表 + return 对应输出**」,就能写出绝大多数控制块。建议先做完 4.2 手把手 再看本页。 — https://lpplc.cn/wiki/ddc/04-03-lua-interface.html - 04-04-export-share-manage — 这一页面向**做块并交付给客户的工程商 / 中间商**:做好的块怎么加密保护、怎么导出成文件发给客户、客户怎么导入使用,以及怎么在「块管理」里维护这些块。制作块本身见 4.2,写 Lua 见 4.3。 — https://lpplc.cn/wiki/ddc/04-04-export-share-manage.html - 04-05-case-studies — 这里给几个可以直接照抄、改改参数就能用的完整自定义块,覆盖最常用的几类技巧:**时间累计、限幅、线性标定、PI 调节、多输出**。每个案例都给出引脚定义表和完整 Lua,接口含义见 4.3。 — https://lpplc.cn/wiki/ddc/04-05-case-studies.html - 04-06-custom-block-faq — 把制作、写 Lua、拖用、加密交付各环节最常见的问题集中在这里。普通逻辑编程的排错见 3.2 常见问题。 — https://lpplc.cn/wiki/ddc/04-06-custom-block-faq.html - 例程总览 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — **可直接照抄的场景程序**:每个例程给出**编辑器同款的块图**和**对应的 ddc.json**、要点、验证方法和注意事项。 — https://lpplc.cn/wiki/ddc/b-00-example-overview.html - 基础控制例程 2:带回差的温度开关 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-01-basic-control 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-01-basic-control-2-hysteresis-temp-switch.html - 基础控制例程 3:报警指示(常亮 / 慢闪 / 快闪) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-01-basic-control 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-01-basic-control-3-alarm-indication.html - 基础控制例程 4:故障锁存、确认与消音 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-01-basic-control 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-01-basic-control-4-alarm-latch-mute.html - 基础控制例程 5:多条件联动(与 / 或 / 非) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-01-basic-control 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-01-basic-control-5-multi-condition-logic.html - 基础控制例程 6:手 / 自动切换(多路选择) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-01-basic-control 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-01-basic-control-6-manual-auto-switch.html - 基础控制例程 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 逻辑编程最常用的一组基础回路:**启停保持、回差开关、报警指示、故障锁存、多条件联动、手自动切换**。 — https://lpplc.cn/wiki/ddc/b-01-basic-control.html - 时序与定时例程 2:断开延时(人走灯延时灭 / 停机后风扇延时冷却) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-02-timing 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-02-timing-2-off-delay.html - 时序与定时例程 3:定时脉冲(按固定节奏动作) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-02-timing 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-02-timing-3-pulse-timer.html - 时序与定时例程 4:定时循环做慢速统计(每 10 秒记一次峰值) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-02-timing 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-02-timing-4-periodic-statistics.html - 时序与定时例程 5:按时段自动启停(系统时钟) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-02-timing 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-02-timing-5-schedule-start-stop.html - 时序与定时例程 6:一用一备轮换(每次启动换一台) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-02-timing 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-02-timing-6-standby-rotation.html - 时序与定时例程 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 「先开风机、30 秒后再开压缩机」「人走灯延时灭」「按时段自动启停」——这类和时间有关的控制, — https://lpplc.cn/wiki/ddc/b-02-timing.html - 模拟量与工程量例程 2:限幅 + 取整(夹住异常值再写进 D) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-03-analog-scaling 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-03-analog-scaling-2-clamp-and-round.html - 模拟量与工程量例程 3:多路温度取最高 / 最低 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-03-analog-scaling 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-03-analog-scaling-3-max-min-of-many.html - 模拟量与工程量例程 4:白天 / 夜间 / 周末三套设定值(工况切换) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-03-analog-scaling 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-03-analog-scaling-4-schedule-setpoints.html - 模拟量与工程量例程 5:状态字拆分与合并(取位 / 合并位) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-03-analog-scaling 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-03-analog-scaling-5-status-word-bits.html - 模拟量与工程量例程 6:运行小时累计与保养提醒(保持寄存器) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-03-analog-scaling 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-03-analog-scaling-6-running-hours-maintenance.html - 模拟量与工程量例程 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 传感器送来的是原始读数(4~20mA、0~4000 这类),要先**换算成工程量**(℃、%、kPa)才能比较和显示。 — https://lpplc.cn/wiki/ddc/b-03-analog-scaling.html - HVAC 暖通例程 2:加热工况(反作用)+ 停机清零 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-04-hvac 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-04-hvac-2-heating-reaction-zeroing.html - HVAC 暖通例程 3:新风 / 回风焓值比较(经济运行) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-04-hvac 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-04-hvac-3-enthalpy-economizer.html - HVAC 暖通例程 4:露点防结露(送风温度不低于露点) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-04-hvac 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-04-hvac-4-dewpoint-anti-condensation.html - HVAC 暖通例程 5:冷却塔风机(湿球温度 + 出水温度双条件) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-04-hvac 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-04-hvac-5-cooling-tower-fan.html - HVAC 暖通例程 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 暖通专用块只有两个(PI 控制、空调参数计算),但它们是 DDC 的看家本事: — https://lpplc.cn/wiki/ddc/b-04-hvac.html - 综合场景例程 2:恒压供水(一用一备轮换 + 压力回差) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-05-integrated-scenarios 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-05-integrated-scenarios-2-constant-pressure-water-supply.html - 综合场景例程 3:水箱液位(双泵 + 高低报警 + 报警锁存) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-05-integrated-scenarios 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-05-integrated-scenarios-3-tank-level-two-pumps.html - 综合场景例程 4:新风机组(时段启停 + 送风 PI + 防冻 + 滤网堵塞) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-05-integrated-scenarios 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-05-integrated-scenarios-4-fresh-air-handling-unit.html - 综合场景例程 5:从站掉线保护(第三方数据参与控制时的必备保护) [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 这一页只讲这一个例程。母页 b-05-integrated-scenarios 里留着例程 1,其余例程各自一页、在那一页的目录里点。 — https://lpplc.cn/wiki/ddc/b-05-integrated-scenarios-5-slave-offline-protection.html - 综合场景例程 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8922 LP6666] — 5 个完整的小工程:**风机盘管、恒压供水、水箱液位、新风机组、从站掉线保护**。 — https://lpplc.cn/wiki/ddc/b-05-integrated-scenarios.html - 算术运算 — 算术运算(类型名 `ddc_arith`):算术运算:加、减、乘、除、指数。除数为 0 时结果为 0。 — https://lpplc.cn/wiki/ddc/blocks/ddc-arith.html - 赋值 — 赋值(类型名 `ddc_assign`):将表达式计算结果写入变量。范围: D 0~7999, DD/DF 0~7998(各占两格 D), M 0~7679, X/Y 八进制 0~377, T 0~511, C 0~… — https://lpplc.cn/wiki/ddc/blocks/ddc-assign.html - 取位运算 — 取位运算(类型名 `ddc_bitget`):取输入整数部分的某一位(0/1),选"整数"则取整(舍弃小数)。 — https://lpplc.cn/wiki/ddc/blocks/ddc-bitget.html - 合并位运算 — 合并位运算(类型名 `ddc_bitmerge`):把 16 个数字量按位合并成一个整数(非零=1),BIT0 在最低位。不用的位接数字常量 0。 — https://lpplc.cn/wiki/ddc/blocks/ddc-bitmerge.html - 系统时钟 — 系统时钟(类型名 `ddc_clock`):取设备系统时间。周:周日=1,周一=2 …… 周六=7。 — https://lpplc.cn/wiki/ddc/blocks/ddc-clock.html - 比较运算 — 比较运算(类型名 `ddc_cmp`):比较运算:成立输出 1,不成立输出 0。 — https://lpplc.cn/wiki/ddc/blocks/ddc-cmp.html - 取通信变量 — 取通信变量(类型名 `ddc_comm_ref`):读从站通信变量值(对齐西门子"取通信变量"):本平台由 DTU 功能把从站数据采集到 D 寄存器,这里填采集写入的目标寄存器号。 — https://lpplc.cn/wiki/ddc/blocks/ddc-comm-ref.html - 从站通信状态 — 从站通信状态(类型名 `ddc_comm_state`):读从站通信状态(对齐西门子"通信从设备状态值",用于判断从站掉线)。本平台在 DTU/采集配置里把从站状态字指向一个 D 寄存器,这里填该寄存器号。 — https://lpplc.cn/wiki/ddc/blocks/ddc-comm-state.html - 数字型常量 — 数字型常量(类型名 `ddc_const`):数字常量,可输入小数。 — https://lpplc.cn/wiki/ddc/blocks/ddc-const.html - 开关量常量(真 / 假) — 开关量常量(真 / 假)(类型名 `ddc_digital_const`):数字型常量:真(1) 或 假(0)。 — https://lpplc.cn/wiki/ddc/blocks/ddc-digital-const.html - HMI显示主循环 — HMI显示主循环(类型名 `ddc_display_loop`):对齐西门子"HMI显示主循环":块面上没有任何参数(官方页的输入/输出都写"无")。里面放"一般页"块;整个工程仅 1 个,主页面+子页面合计最多 2… — https://lpplc.cn/wiki/ddc/blocks/ddc-display-loop.html - 脉冲触发(上升沿 / 下降沿) — 脉冲触发(上升沿 / 下降沿)(类型名 `ddc_edge`):输入出现上升/下降沿时,输出 1 持续一个扫描周期,其余时间输出 0。每个块是独立实例。 — https://lpplc.cn/wiki/ddc/blocks/ddc-edge.html - HMI枚举文本列表显示 — HMI枚举文本列表显示(类型名 `ddc_enum_text`):对齐西门子"枚举文本列表":官方 pin 表里它有一条「输入」—— 给它接一个寄存器,块输出该寄存器值对应的那一项文本。索引 **0 基**(值 0→… — https://lpplc.cn/wiki/ddc/blocks/ddc-enum-text.html - 空调参数计算 — 空调参数计算(类型名 `ddc_hvac`):由干球温度(°C)和相对湿度(%)计算湿空气参数。 — https://lpplc.cn/wiki/ddc/blocks/ddc-hvac.html - 条件判断(如果…则…否则) — 条件判断(如果…则…否则)(类型名 `ddc_if`):对齐西门子"条件判断":条件非零执行"则";否则按序检查每个"否则如果",第一个成立的执行其命令行;都不成立执行"否则"。 — https://lpplc.cn/wiki/ddc/blocks/ddc-if.html - 限值运算 — 限值运算(类型名 `ddc_limit`):小于下限取下限,大于上限取上限,之间取输入值。 — https://lpplc.cn/wiki/ddc/blocks/ddc-limit.html - 线性变换 — 线性变换(类型名 `ddc_linear`):Out=(Y2-Y1)×(In-X1)/(X2-X1)+Y1,结果限制在 Y1~Y2 之间。如 4~20mA 转 -40~70°C。 — https://lpplc.cn/wiki/ddc/blocks/ddc-linear.html - 逻辑与 / 或 — 逻辑与 / 或(类型名 `ddc_logic`):逻辑与/或:非零即真,结果为 1 或 0。 — https://lpplc.cn/wiki/ddc/blocks/ddc-logic.html - 应用逻辑主循环 — 应用逻辑主循环(类型名 `ddc_main_loop`):程序从上到下循环运行,每轮扫描后等待设定的毫秒数。整个画布放置一个。 — https://lpplc.cn/wiki/ddc/blocks/ddc-main-loop.html - HMI菜单行显示 — HMI菜单行显示(类型名 `ddc_menu_row`):对齐西门子"HMI菜单行显示":**就是三个槽位** —— 文本/值/其他 三个连线端子并排在同一行上(官方块面如此),块上没有小数位、格式或读写参数。文本=… — https://lpplc.cn/wiki/ddc/blocks/ddc-menu-row.html - 最大 / 最小值 — 最大 / 最小值(类型名 `ddc_minmax`):取两个输入之间的最大值或最小值。 — https://lpplc.cn/wiki/ddc/blocks/ddc-minmax.html - 多路选择 — 多路选择(类型名 `ddc_mux`):按选择因子(0~7,对应输入1~输入8;负数取输入1,越界取输入8)输出对应输入的值。 — https://lpplc.cn/wiki/ddc/blocks/ddc-mux.html - 逻辑非 — 逻辑非(类型名 `ddc_not`):逻辑非:非零输入输出 0,零输入输出 1。 — https://lpplc.cn/wiki/ddc/blocks/ddc-not.html - HMI一般页 — HMI一般页(类型名 `ddc_page`):对齐西门子"HMI一般页"。官方块图自带「页名」输入框与「密码等级」下拉——保护等级是**逐页**属性,不是全工程一份(西门子"界面保护"一节原文:"除首页外,每个显示界… — https://lpplc.cn/wiki/ddc/blocks/ddc-page.html - 参数引用(制作器内) — 参数引用(制作器内)(类型名 `ddc_param`):引用自定义块的参数:使用者在调用块上设置的常量。只出现在块制作器的图形逻辑里。 — https://lpplc.cn/wiki/ddc/blocks/ddc-param.html - PI 控制 — PI 控制(类型名 `ddc_pi`):PI回路控制,输出0~100。正比例=true用于制冷(输入↑输出↑),false用于制热。积分时间Ti(秒)越大积分越弱,0=关闭积分(对齐西门子"常数",默认128秒)。死… — https://lpplc.cn/wiki/ddc/blocks/ddc-pi.html - 输入引脚引用(制作器内) — 输入引脚引用(制作器内)(类型名 `ddc_pin`):引用自定义块的输入引脚:使用者拖放本块时在该输入上接的实参值。只出现在块制作器的图形逻辑里。 — https://lpplc.cn/wiki/ddc/blocks/ddc-pin.html - 寄存器引用(取 / 设) — 寄存器引用(取 / 设)(类型名 `ddc_ref`):引用一个寄存器。;「取(只读)」= 只把它的值显示出来(西门子的模拟输入);;「设(屏上可改)」= 这一处引用是**落点**:它接在 HMI 菜单行的「值」上(… — https://lpplc.cn/wiki/ddc/blocks/ddc-ref.html - 启停控制(RS 触发器) — 启停控制(RS 触发器)(类型名 `ddc_rs`):启动信号置1,停止信号置0;都为0时保持;同时为1时停止优先(复位优先)。每个块是独立实例。 — https://lpplc.cn/wiki/ddc/blocks/ddc-rs.html - 累计时间 — 累计时间(类型名 `ddc_runtime`):输入为1时累计时间,为0暂停;复位为1时清零重新累计。小时模式按0.1小时(6分钟)步进。保持寄存器填平台的保持区 D(如 D200~D512,0=不保持)即可断电续计… — https://lpplc.cn/wiki/ddc/blocks/ddc-runtime.html - HMI子页 — HMI子页(类型名 `ddc_subpage`):对齐西门子"HMI子页":官方块图与"一般页"同形——**子页自己带着行1~行4**,同时有一个输出端子接上一级页面的某一行(旧版我们只做了一个页名字符串,无法表达跳… — https://lpplc.cn/wiki/ddc/blocks/ddc-subpage.html - 自定义块内部逻辑 — 自定义块内部逻辑(类型名 `ddc_subroutine`):【内部保留】自定义功能块内部逻辑容器,图形化制作入口本期已下线,正常编程不会用到。 — https://lpplc.cn/wiki/ddc/blocks/ddc-subroutine.html - HMI普通文本显示 — HMI普通文本显示(类型名 `ddc_text`):对齐西门子"HMI普通文本显示":官方块面上写的就是「字符串」,无输入引脚、一个字符串输出。可整行使用,也可接到菜单行的「文本」或「其他」端子上。 — https://lpplc.cn/wiki/ddc/blocks/ddc-text.html - 定时循环 — 定时循环(类型名 `ddc_timed_loop`):主循环之外按固定秒数周期执行,内部命令每轮执行一遍。每个画布最多放 3 个。 — https://lpplc.cn/wiki/ddc/blocks/ddc-timed-loop.html - 定时器(接通/断开延时/脉冲) — 定时器(接通/断开延时/脉冲)(类型名 `ddc_timer`):接通延时:输入为1持续Ti秒后输出1。断开延时:输入变0持续Ti秒后输出0。脉冲:输入上升沿后输出1持续Ti秒。时间设置引脚接表达式可动态改 Ti,未… — https://lpplc.cn/wiki/ddc/blocks/ddc-timer.html - 逻辑编程(DDC 图形化编程) — **每个自带功能块还有一页自己的详解**(共 35 页,形如 `blocks/ddc-timer.html`):块面参数、连线端子、下发成什么操作、示例与常见问题。 — https://lpplc.cn/wiki/ddc/ ### dtu - 0.1 十分钟上手:采一路 Modbus 仪表并送到云端 — 这一节走一遍最短的闭环:把一台现场 Modbus 仪表的数据采进 PLC 寄存器,再送到云端,在云组态画面上看到数值。 — https://lpplc.cn/wiki/dtu/00-01-ten-minute-start.html - 1.1 云交互数据点 — 「云交互」把 PLC 的寄存器一条条绑成云端数据点。绑好之后设备自动把值同步到服务器,数据在服务器的实时数据库里成为一个**数据点**,可以去画曲线、存历史、做报警、在云组态画面上绑定显示。 — https://lpplc.cn/wiki/dtu/01-01-cloud-datapoints.html - 1.2 串口设备采集 — 「串口设备」页用来采集挂在设备串口上的第三方从机:Modbus 仪表、DL/T645 电表、三菱 FX PLC。采集到的数据写进指定的 PLC 寄存器,之后可以被云交互上云、被梯形图或逻辑编程读取参与控制。 — https://lpplc.cn/wiki/dtu/01-02-serial-acquisition.html - 1.3 MQTT — 「MQTT」子标签把寄存器的值按 JSON 模板**上报到 MQTT Broker**,同时可以**订阅平台下发的命令**把收到的 JSON 按字段映射到目标寄存器。全程不需要写一行 Lua,平台是 EMQX / M… — https://lpplc.cn/wiki/dtu/01-03-mqtt.html - 1.4 HTTP — 「HTTP」子标签把寄存器**定时发到 HTTP 服务器**(POST / GET),同时按点位表把**响应 JSON 的字段落进寄存器**。一次请求往返同时完成上报和拉取,不需要写一行 Lua。 — https://lpplc.cn/wiki/dtu/01-04-http.html - 2.1 BACnet — 把本机寄存器发布成 BACnet 对象,楼宇 BMS 直接来读;反过来也能去轮询其他 BACnet 设备。 — https://lpplc.cn/wiki/dtu/02-01-bacnet.html - 2.2 OPC UA — 把寄存器发布成 OPC UA 节点,组态软件(KingSCADA、WinCC、Ignition 等)按标准客户端接进来。 — https://lpplc.cn/wiki/dtu/02-02-opcua.html - 2.3 水务遥测 — 按 SZY206-2016 / SL/T 427 规约把寄存器上报给水务中心站,断网期间存盘、恢复后按原时标补报。 — https://lpplc.cn/wiki/dtu/02-03-water-telemetry.html - 4.1 配置 JSON 与批量部署 — 「查看 JSON」页显示完整配置的 JSON,还能**导入 JSON 配置**。这是批量部署现场多台设备最快的做法。 — https://lpplc.cn/wiki/dtu/04-01-config-json-deploy.html - A. 常见问题与排查 — 按现象逐条对照,从上往下查。若还没有明确线索,先按这张图的顺序排查一遍 —— 它按「最可能的原因」排序: — https://lpplc.cn/wiki/dtu/a-01-faq-troubleshooting.html - DTU 配置式编程 — DTU 配置式编程是 LP 系列设备的**免代码编程方式**:在上位机里勾选、填表,设备就会按您的配置去采集仪表、上云、转发数据、做条件报警。全程不写一行代码。 — https://lpplc.cn/wiki/dtu/ ### 总览 - index — (本页无导语) — https://lpplc.cn/wiki/ ### lua - Lua 脚本编程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — Lua 脚本是 LPPLC 平台的核心差异化能力。**梯形图负责控制逻辑,Lua 负责通信与数据处理**,使传统 PLC 具备工业物联网网关能力。 — https://lpplc.cn/wiki/lua/00-01-capability-overview.html - Lua 库总表 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 设备上能被脚本调用的全部 Lua 库:共 **50 个库、413 个库级函数 + 161 个对象方法**。 — https://lpplc.cn/wiki/lua/00-02-libraries-index.html - Lua 语言概述 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 了解 Lua 语言的特点及其在 LPPLC 工业控制器中的应用 — https://lpplc.cn/wiki/lua/01-01-introduction.html - 基础语法 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 掌握 Lua 变量、数据类型和运算符 — https://lpplc.cn/wiki/lua/01-02-basic-syntax.html - 流程控制 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 掌握 Lua 条件判断、循环和跳转控制 — https://lpplc.cn/wiki/lua/01-03-flow-control.html - 函数 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 掌握 Lua 函数定义、参数传递和闭包 — https://lpplc.cn/wiki/lua/01-04-functions.html - 表与数据结构 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 掌握 Lua 表(Table):Lua 中唯一的数据结构,通用容器 — https://lpplc.cn/wiki/lua/01-05-tables-structures.html - 第一个 Lua 脚本 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 从编写到运行,5 分钟完成第一个 LPPLC Lua 程序 — https://lpplc.cn/wiki/lua/01-06-first-script.html - Lua基础库 - 新手必看的入门指南 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 基础库(`type`/`tonumber`/`tostring`/`print`/`pcall`/`assert`)是 Lua 自带的,无需加载模块。下面例程都是**可直接下载运行的完整脚本**:顶层执行完即结束,不… — https://lpplc.cn/wiki/lua/02-01-base.html - 字符串库 - 简单易懂的文字处理指南 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 字符串库(`string.*`)是 Lua 自带模块,处理「设备返回的文本、日志、配置文件、上报报文」都离不开它。下面例程都是**可直接下载运行的完整脚本**:顶层执行完即结束,不阻塞主循环。核心难点是**模式匹配*… — https://lpplc.cn/wiki/lua/02-02-string.html - Table 表库使用说明 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 表库(`table.*`)用来组织「一组采样点、一批配置、一帧报文」这类列表数据,是工业脚本里用得最多的结构。下面例程都是**可直接下载运行的完整脚本**:顶层执行完即结束,不阻塞主循环。 — https://lpplc.cn/wiki/lua/02-03-table.html - Math 数学库使用说明 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 数学库(`math.*`)做量程标定、取整、随机、统计量。下面例程都是**可直接下载运行的完整脚本**:顶层执行完即结束,不阻塞主循环。工业里最常用的是「把 4–20mA / 0–10V 原始值换算成工程值」。 — https://lpplc.cn/wiki/lua/02-04-math.html - 文件操作库 - 简单易懂的文件处理指南 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — ⚠ 文件库(`io.*`)需要**文件系统**支持:**仅软PLC模拟器 / 上位机** 可用;嵌入式固件(LP3201/LP3202/LP3203/LP3222/LP3232/LP3288 等)通常没有文件系统,`… — https://lpplc.cn/wiki/lua/02-05-io.html - OS 操作系统库使用说明 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 系统库(`os.*`)提供时间、计时、少量系统交互。下面例程都是**可直接下载运行的完整脚本**:顶层执行完即结束,不阻塞主循环。注意:固件上 `os.time/os.date/os.clock` 一般可用,但 `o… — https://lpplc.cn/wiki/lua/02-06-os.html - 标准库在不同机型上的差异 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 本页是「机型差异参考」,没有专属 API;但「怎么写一份在每台机器上都能跑完、不崩」的脚本,本身就是最重要的能力。下面 3 个例程演示**运行时探测可用 API** 的写法,都是**可直接下载运行的完整脚本**,且不… — https://lpplc.cn/wiki/lua/02-07-stdlib-model-differences.html - system — 系统功能 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 2026-10-22 起脚本侧的 `system.recv` 已删除(泵在 C 侧)。更早的固件上手写的 — https://lpplc.cn/wiki/lua/03-01-system.html - timer — 定时器 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/03-02-timer.html - 并发模型概述 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8913 LP8916 软PLC模拟器 上位机] — 2026-10-22 起,脚本侧**不再有** `system.recv` 这个入口(泵已在 C 侧,旧脚本里手写的 — https://lpplc.cn/wiki/lua/03-03-concurrency-overview.html - task — 后台任务 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8913 LP8916 软PLC模拟器 上位机] — 任务里**让出/延时用 `system.sleep(ms)`**,没有单独的 `task.sleep`。 — https://lpplc.cn/wiki/lua/03-04-task.html - event — 事件订阅与发布 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8913 LP8916 软PLC模拟器 上位机] — 延时统一用 **`system.sleep(ms)`**(任务内等价于让出一拍),没有单独的 `task.sleep`。 — https://lpplc.cn/wiki/lua/03-05-event.html - coroutine — 协程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/03-06-coroutine.html - plc — PLC 数据交互 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/04-01-plc.html - HTTP 客户端例程 2:事件触发的同步上报(要服务端回执时才值得同步) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-01-http。 — https://lpplc.cn/wiki/lua/05-01-http-2-sync-report-on-event.html - HTTP 客户端例程 3:周期异步上报(推荐做法)+ 失败退避 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-01-http。 — https://lpplc.cn/wiki/lua/05-01-http-3-async-report-backoff.html - HTTP 客户端例程 4:现场常用脚本 `http.LPLUA`(原文) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-01-http。 — https://lpplc.cn/wiki/lua/05-01-http-4-sample-script-http.html - http — HTTP 客户端 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/05-01-http.html - MQTT 客户端例程 2:订阅云端下发控制本地输出,并回 ACK [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-02-mqtt。 — https://lpplc.cn/wiki/lua/05-02-mqtt-2-subscribe-ack-control.html - MQTT 客户端例程 3:采集上报 + 云端下发的完整骨架(推荐直接照抄) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-02-mqtt。 — https://lpplc.cn/wiki/lua/05-02-mqtt-3-full-skeleton.html - mqtt — MQTT 客户端 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完回调与定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/05-02-mqtt.html - TCP 客户端例程 2:按换行分帧解析 JSON 指令(处理粘包 / 半包) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-03-tcp-client。 — https://lpplc.cn/wiki/lua/05-03-tcp-client-2-json-line-framing.html - TCP 客户端例程 3:串口 ↔ TCP 透传(把现场串口设备搬到远端) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-03-tcp-client。 — https://lpplc.cn/wiki/lua/05-03-tcp-client-3-serial-tcp-bridge.html - TCP 客户端例程 4:现场常用脚本 `网口透传.LPLUA`(原文) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-03-tcp-client。 — https://lpplc.cn/wiki/lua/05-03-tcp-client-4-sample-script-bridge.html - tcp_client — TCP 客户端 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完回调与定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/05-03-tcp-client.html - TCP 服务器例程 2:多客户端连接表 + 周期广播 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-04-tcp-server。 — https://lpplc.cn/wiki/lua/05-04-tcp-server-2-client-table-broadcast.html - TCP 服务器例程 3:加接入校验(安全,强烈建议) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-04-tcp-server。 — https://lpplc.cn/wiki/lua/05-04-tcp-server-3-access-validation.html - tcp_server — TCP 服务器 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — **安全提示**:本模块不提供任何认证或访问控制。任何能访问到该端口的主机都可以连接并发送数据,而回调里通常会直接写 PLC 寄存器。部署到公网或不可信网段前,需在回调里自行做身份校验,或用防火墙限制来源。 — https://lpplc.cn/wiki/lua/05-04-tcp-server.html - 网络工具例程 2:外网连通性探测 + 状态镜像 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-05-net。 — https://lpplc.cn/wiki/lua/05-05-net-2-connectivity-probe.html - 网络工具例程 3:手写 TCP 客户端(raw socket,需谨慎) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-05-net。 — https://lpplc.cn/wiki/lua/05-05-net-3-raw-tcp-client.html - 网络工具例程 4:手写 TCP 服务器(支持多个客户端) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-05-net。 — https://lpplc.cn/wiki/lua/05-05-net-4-raw-tcp-server.html - 网络工具例程 5:手写 UDP 服务器(一问一答) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-05-net。 — https://lpplc.cn/wiki/lua/05-05-net-5-raw-udp-echo.html - 网络工具例程 6:周期 Ping 多个目标(定时器 + net.ping) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-05-net。 — https://lpplc.cn/wiki/lua/05-05-net-6-periodic-ping-multi.html - net — 网络工具 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP8913 LP8916 LP8922 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**。`net` 是底层工具,日常收发优先用 `tcp_client`/`tcp_server`/`udp`;`net` 适合校时、连通性、手写 socket。 — https://lpplc.cn/wiki/lua/05-05-net.html - UDP 通信例程 2:周期广播状态(JSON) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-06-udp。 — https://lpplc.cn/wiki/lua/05-06-udp-2-periodic-broadcast.html - UDP 通信例程 3:对端存活探测(发 PING 等 PONG) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页只讲这一个例程。同组其余例程、以及这个库的函数说明都在 05-06-udp。 — https://lpplc.cn/wiki/lua/05-06-udp-3-peer-liveness-ping.html - udp — UDP 通信 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:`creat` 建对象、`reg` 注册收包回调、`start` 启动收包线程,脚本注册完即结束。 — https://lpplc.cn/wiki/lua/05-06-udp.html - websocketserver — WebSocket 服务器 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — **安全提示**:本模块不提供认证。任何能访问该端口的浏览器都能建立连接。部署到公网前请用防火墙或端口映射策略限制来源。 — https://lpplc.cn/wiki/lua/05-07-websocketserver.html - com — 串口通信 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完串口/子设备/定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/06-01-com.html - opcua — OPC UA [LP3232 LP3288] — `opcua` 模块的完整说明在 10.2 OPC UA (opcua),本页仅作指引。 — https://lpplc.cn/wiki/lua/06-06-opcua.html - com_modbus — 串口 Modbus 主站 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — **字节序设置与通道数据类型必须配对** — https://lpplc.cn/wiki/lua/07-01-com-modbus.html - com_fx — 串口三菱 FX 协议 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:`com_fx` 只描述「要读写哪些软元件」,挂到 `com` 并 `start` 后由后台线程轮询,脚本注册完即结束。 — https://lpplc.cn/wiki/lua/07-02-com-fx.html - com_dlt645 — DLT645 电表 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:`com_dlt645` 只描述「要读这台表的哪些量」,挂到 `com` 并 `start` 后由后台线程轮询,脚本注册完即结束。 — https://lpplc.cn/wiki/lua/07-03-com-dlt645.html - modbus — Modbus TCP 主站(自动轮询) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 本模块**没有** `WRITE` 常量。要往从站写,用 `READ_WRITE`。 — https://lpplc.cn/wiki/lua/07-04-modbus.html - pipe — 统一管道通信 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — **平台差异**:三菱 MC、三菱 A 系列、欧姆龙 FINS、西门子 SMART/S7-200/S7-300、台达、信捷、汇川等协议**只在上位机版本和 Linux 网关版本里提供**,ESP32 机型暂不支持。在… — https://lpplc.cn/wiki/lua/08-01-pipe-overview.html - pipe "mc" — 三菱 MC 协议 [LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**(仅上位机 / Linux 网关版本,ESP32 上 `pipe.setup("mc", ...)` 返回 `nil`)。通用读写接口见 8.1 概述。统一模板「场景 / … — https://lpplc.cn/wiki/lua/08-02-pipe-mc.html - pipe "fins" — 欧姆龙 FINS 协议 [LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**(仅上位机 / Linux 网关版本,ESP32 上 `pipe.setup("fins", ...)` 返回 `nil`)。通用接口见 8.1 概述。统一模板「场景 / … — https://lpplc.cn/wiki/lua/08-03-pipe-fins.html - pipe 西门子 S7 系列 [LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**。西门子分 4 个协议(`s71200`/`s7300`/`siemens_smart`/`siemens_s7200`),**只有 `s71200` 在 ESP32 上支… — https://lpplc.cn/wiki/lua/08-04-pipe-s7.html - pipe "delta" — 台达 PLC [LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**(仅上位机 / Linux 网关版本,ESP32 上 `pipe.setup("delta", ...)` 返回 `nil`)。底层是串口 Modbus RTU,但地址用台… — https://lpplc.cn/wiki/lua/08-05-pipe-delta.html - pipe "xinje" — 信捷 PLC [LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**(仅上位机 / Linux 网关版本,ESP32 上 `pipe.setup("xinje", ...)` 返回 `nil`)。底层串口 Modbus RTU,地址用信捷软… — https://lpplc.cn/wiki/lua/08-06-pipe-xinje.html - pipe "inovance" — 汇川 PLC [LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**(仅上位机 / Linux 网关版本,ESP32 上 `pipe.setup("inovance", ...)` 返回 `nil`)。底层是以太网 Modbus TCP,地… — https://lpplc.cn/wiki/lua/08-07-pipe-inovance.html - mc_server — 三菱 MC 协议从站服务器 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 本模块从注册到运行**只有 `start` 一个入口**,没有回调、没有 `set/creat/get_*` 等方法。脚本只要 `start` 并全局持有返回对象即可。统一模板「场景 / 完整代码 / 要点 / 验证… — https://lpplc.cn/wiki/lua/09-01-mc-server.html - modbus_tcp_server — Modbus TCP 从站服务器 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 本模块**只有 `start` 一个入口**,没有回调、没有其它方法。脚本 `start` 并全局持有返回对象即可,软元件映射由固件完成。统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/09-02-modbus-tcp-server.html - bacnet — BACnet 楼宇自控(MS/TP 与 BACnet/IP) [LP3232 软PLC模拟器] — `AI` / `BI` / `MSI` 在标准里就是采集量。给它们配 `bacnet.READ_WRITE` 会被**静默降级成只读**,不会报错。要让 BMS 能写就用 `AO` / `AV` / `BO` / `… — https://lpplc.cn/wiki/lua/10-01-bacnet.html - opcua — OPC UA [LP3232 LP3288 软PLC模拟器] — 每个例程都是**可直接下载运行的完整脚本**(仅 LP3232 / LP3288 / 软PLC模拟器支持)。`creat` 不会连接/监听,要 `start()` 才真起来。统一模板「场景 / 完整代码 / 要点 /… — https://lpplc.cn/wiki/lua/10-02-opcua.html - water — 水务遥测(SZY206-2016 / SL/T 427) [LP3232 LP3288 软PLC模拟器] — 每个例程都是**可直接下载运行的完整脚本**:配置完调 `node:start()` 后脚本即结束,报文分帧/编码/重发/补报全部由固件按标准做。 — https://lpplc.cn/wiki/lua/10-03-water.html - pid — PID 闭环控制 [上位机 软PLC模拟器 LP8910 LP8913 LP8916 LP8922] — ⚠ 本模块**仅 Windows / Linux 上位机(软 PLC、模拟器)提供**,ESP32 机型(LP3202/LP3203/LP8910 等)无 `pid`——ESP32 上要做闭环请用梯形图 `PID` … — https://lpplc.cn/wiki/lua/11-01-pid.html - encoder — 编码转换 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-02-encoder.html - crypto — 加密模块 [LP3232 LP3288 LP8910 LP8911 LP8912 LP8913 LP8915 LP8916 LP8922 LP2300 LP2323 软PLC模拟器 上位机] — ⚠ 下面示例只在**带 `crypto` 的机型上**可跑(见页首的机型清单);不带该模块的机型请退回 `plc.aes_encode` 写法。统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-03-crypto.html - data — 共享数据对象 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-04-data.html - json — JSON 编解码 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-05-json.html - fdb — 数据存储 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-06-fdb.html - ini — INI 配置文件 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-07-ini.html - pcnt — 脉冲计数 [定制版] — ⚠ 本模块**仅定制构建提供**,标准 ESP32 固件与软 PLC 模拟器不含 `pcnt`。下面示例仅供定制版。统一模板「场景 / 完整代码 / 要点 / 验证方法 / 注意事项」。 — https://lpplc.cn/wiki/lua/11-08-pcnt.html - plc.cloud_* — 云平台通信 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 每个例程都是**可直接下载运行的完整脚本**:注册完绑定/定时器后脚本就结束,固件自动进入消息泵。 — https://lpplc.cn/wiki/lua/12-01-cloud.html - API 速查表 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 除 `start` 和 `set_keepalive` 外,全部要写成 `mqtt.xxx(client, ...)`,**不能用 `client:xxx()`**。 — https://lpplc.cn/wiki/lua/a-01-api-quickref.html - 常见问题 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — LPPLC Lua 开发中常见问题与解决方案 — https://lpplc.cn/wiki/lua/a-02-faq.html - Lua 与 PLC 协同开发指南 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 理解 Lua 脚本与梯形图程序的运行关系和数据共享机制 — https://lpplc.cn/wiki/lua/a-03-lua-plc-coordination.html - Lua API 全集与机型可用性 — 本页列出固件与模拟器**运行期真的能被调用**的全部 Lua 模块与函数:50 个模块、412 个函数、230 个常量。 — https://lpplc.cn/wiki/lua/a-04-api-availability.html - AI 易错点与反模式 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 写 LPPLC 的 Lua 程序时,下面这些坑**踩一个就足以让程序看起来"能跑但完全不对"**。 — https://lpplc.cn/wiki/lua/a-05-ai-pitfalls.html - 附录 F. 内建扩展与模拟器专有库 [软PLC模拟器 上位机(`utf8`/`debug`/`package` 各机型均可用)] — 本页收录**还没有独立库页**的 Lua 库:`utf8`/`debug`/`package`/`bit32` 是解释器内建扩展, — https://lpplc.cn/wiki/lua/a-06-builtin-and-sim-only-libs.html - 现场程序常见架构套路 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一页讲的不是"某个函数怎么用",而是**一台设备上的程序整体该怎么组织**—— — https://lpplc.cn/wiki/lua/a-07-field-architecture-patterns.html - 例程总览 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这里汇总**可直接下载运行的完整例程**。每个例程都包含:场景、完整代码、要点、验证方法、注意事项。 — https://lpplc.cn/wiki/lua/b-00-example-overview.html - 综合例程:Modbus 温度采集 + MQTT 上报 + 云端下发控制继电器 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 一个端到端的完整工程:**RS485 读温控表 → 定时 MQTT 上报 → 订阅云端下发 → 控制继电器 → 回 ACK**。 — https://lpplc.cn/wiki/lua/b-01-modbus-mqtt.html - 综合例程:串口裸报文收发(同步 / 异步 / 十六进制) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 对端不是 Modbus、三菱、电表这些标准协议,而是一台**私有协议的板子**(扫码枪、称重仪表、 — https://lpplc.cn/wiki/lua/b-02-raw-serial.html - 综合例程:采集第三方设备(三菱 FX / Modbus RTU / Modbus TCP) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 让设备**自己周期性去读**第三方 PLC 或仪表,值自动落到本机的 D / M 或 `data` 对象里, — https://lpplc.cn/wiki/lua/b-03-third-party-devices.html - 综合例程:串口透传(本地双串口 / 远程 / 网口) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 「透传」就是让本设备的串口变成一根**透明的线**:数据不解析、不加工,从 A 口进来就从 B 口出去。 — https://lpplc.cn/wiki/lua/b-04-serial-bridge-modes.html - 综合例程:DL/T 645 电表采集 + MQTT/JSON 上报 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 电表是现场最常见的第三方设备:**抄总电量、抄功率、抄电压电流,然后定时上报云端**。 — https://lpplc.cn/wiki/lua/b-05-dlt645-cloud.html - 综合例程:HTTP 上报与拉取(同步 / 异步) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 对接第三方平台最常见的就是 **HTTP**:定时把数据 `POST` 过去,或者周期性 `GET` 回一段 JSON 指令。 — https://lpplc.cn/wiki/lua/b-06-http-report-pull.html - 综合例程:Lua 语言层(表遍历 / 内存 / 面向对象 / 协程) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 这一组脚本**不碰任何外设**,纯是 Lua 语言本身:把解码出来的一整张表打印清楚、 — https://lpplc.cn/wiki/lua/b-07-language-layer.html - B8. 串口 ↔ 网口互转框架(把现场串口设备搬到远端) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 综合例程。同组其余例程、以及这个库的函数说明在 `05-03-tcp-client`。 — https://lpplc.cn/wiki/lua/b-08-serial-net-bridge.html - B9. 数据加密与校验框架(防篡改 / 防窃听 / 防窥视) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 综合例程。加密原语见 `11-03-crypto`;校验/编码见 `11-02-encoder`、`11-05-json`。 — https://lpplc.cn/wiki/lua/b-09-encryption-checksum.html - B10. 云端双向通信框架(订阅下发 + 周期上报 + 断线重发) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 综合例程。MQTT 原语见 `05-02-mqtt`;完整骨架见 `05-02-mqtt-3-full-skeleton`。 — https://lpplc.cn/wiki/lua/b-10-cloud-two-way-framework.html - B11. 采集 → 换算 → 累计 → 上报框架 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 综合例程。寄存器交互见 `04-01-plc`;定时器见 `03-02-timer`;JSON 见 `11-05-json`。 — https://lpplc.cn/wiki/lua/b-11-collect-convert-accumulate-report.html - B12. 报警判定与上报框架(留回差 / 状态变化才发) [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 综合例程。报警是现场覆盖面最广的一类逻辑;要点是**留回差**和**只在状态变化时上报**,否则平台会被刷爆。 — https://lpplc.cn/wiki/lua/b-12-alarm-hysteresis-framework.html - Lua 编程指南 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — LPPLC 设备内置 Lua 5.4 脚本引擎,可与 PLC 梯形图协同运行。本文档覆盖设备真实支持的所有 Lua 模块 API。 — https://lpplc.cn/wiki/lua/ ### manual - 4.1 质保与售后 — - **30 天无理由退货**(线上购买:寄出费用由本公司承担,退回运费由退货方承担) — https://lpplc.cn/wiki/manual/faq/04-01-warranty.html - 4.2 设备连接 — 设备连接是数据对接的基础,以下汇总了设备接入 LPPLC 服务器时的常见问题与解决方法。 — https://lpplc.cn/wiki/manual/faq/04-02-device-connection.html - 4.3 数据问题 — 注意:轮询时间越短,设备通信负载越高,请根据实际需求合理设置。 — https://lpplc.cn/wiki/manual/faq/04-03-data-issues.html - 4.4 组态问题 — ::: tip 组态问答已归入「WEB 云组态」 — https://lpplc.cn/wiki/manual/faq/04-04-configuration.html - 4.5 故障排除 — ::: tip 服务器侧排查已归入「服务器数据对接」 — https://lpplc.cn/wiki/manual/faq/04-05-troubleshooting.html - 4.6 合作与共建 — LPPLC 设备由本公司提供从设计、生产、销售到售后的全程支持;PLC 固件已连续开发与维护十余年,仍在持续演进。 — https://lpplc.cn/wiki/manual/faq/04-06-partnership.html - 常见问题 — 这里汇总了用户在使用 LPPLC 平台时最常遇到的问题。 — https://lpplc.cn/wiki/manual/faq/ - 使用说明 — 这里管的是**不写程序的那部分**:手上这台是什么型号、怎么接线上电、怎么把它连上电脑、 — https://lpplc.cn/wiki/manual/ - 3.1 LP3232 [LP3232] — 提示:Debug(调试)固件版本因日志占用 UART0,仅编译 COM1;正式(Release)固件两路 485 全部可用。 — https://lpplc.cn/wiki/manual/models/03-01-lp3232.html - 3.2 LP3202 [LP3202] — LP3202 是 LPPLC 边缘计算网关系列的主推型号,基于 **经典 ESP32 双核** 平台,同时具备 **WiFi 与 RJ45 以太网** 两条上云通道,板载 4 入 4 出与 1 路模拟量,并带 2 路… — https://lpplc.cn/wiki/manual/models/03-02-lp3202.html - 3.3 LP3201 [LP3201] — LP3201 是在 LP3202 基础上把 **DC24V 供电改成 AC220V 市电供电**的型号,其余硬件、点位与接口与 LP3202 一致:经典 ESP32 双核平台,WiFi 与 RJ45 网口双上云通道,… — https://lpplc.cn/wiki/manual/models/03-03-lp3201.html - 3.4 LP8910 [LP8910] — LP8910 是 LPPLC 边缘计算网关系列中基于 RDA8910 4G Cat1 平台的标准型号,内置 4G 全网通模块(Air724UG),板载 4 入 4 出与 3 路 RS485,适用于现场没有网线也没有 … — https://lpplc.cn/wiki/manual/models/03-04-lp8910.html - 3.5 LP8916 [LP8916] — LP8916 是 LPPLC 边缘计算网关系列中的 4G DTU 型号,蓝色小巧外壳,8 位可插拔端子,内置 4G Cat1 模块,插入流量卡即可上云。板载 1 路数字输入、1 路继电器输出与 1 路 RS485,主… — https://lpplc.cn/wiki/manual/models/03-05-lp8916.html - 3.6 LP3205 [LP3205] — LP3205 是 LPPLC **边缘计算网关系列**里的**无线型网关**(ESP32 平台,支持 Lua,固件标识 `lp3205cd`,成都 LoRa 版):**WiFi + 以太网 + LoRa 三种通信方式… — https://lpplc.cn/wiki/manual/models/03-06-lp3205.html - 3.7 LP3203 [LP3203] — LP3203 是 LPPLC PLC系列中的多 I/O 经济型号(ESP32 平台,支持 Lua),**8 入 8 出**大点位、纯 WiFi 无线联网(无网口),适用于需要较多数字量点位、又希望免布线控制成本的工业… — https://lpplc.cn/wiki/manual/models/03-07-lp3203.html - 3.8 LP3222 [LP3222] — LP3222 是 LPPLC PLC系列中的多 IO 型 MR 控制器(ESP32 平台,支持 Lua),**8 入 6 出**,导轨安装的分体式外壳,适合需要更多输入输出点的中型项目。 — https://lpplc.cn/wiki/manual/models/03-08-lp3222.html - 3.9 LP8913 [LP8913] — LP8913 是 LPPLC PLC系列中的 4G 高 IO 型号,与 LP8910 同为 4G Cat1 平台,点位为 **8 入 8 出**并带 1 路模拟量输入,同时有 **3 路 RS485**,适合需要较多… — https://lpplc.cn/wiki/manual/models/03-09-lp8913.html - 3.10 LP8922 [LP8922] — LP8922 是 LPPLC 基于 **RDA8910(4G Cat1)** 平台的 4G 型梯形图 PLC,**8 入 6 出**(继电器输出),板载 4G 模块(Air724UG),插一张全网通 SIM 卡即可上… — https://lpplc.cn/wiki/manual/models/03-10-lp8922.html - 3.11 LP2252MT [LP2252MT] — 注意:这里的 `A+ / B+` 是模拟量输入端子,不是 RS485。RS485 是上排的 `A / B` 端子。 — https://lpplc.cn/wiki/manual/models/03-11-lp2252mt.html - 3.12 LP2252MR [LP2252MR] — LP2252MR 是 LPPLC 系列里的多串口 MR 型控制器(STM32F103 平台,带 RJ45 网口), — https://lpplc.cn/wiki/manual/models/03-12-lp2252mr.html - 3.13 LP2222MT [LP2222MT] — LP2222MT 是 LPPLC PLC系列中的经济型 MT 控制器(STM32 平台,带网口),适合预算有限的小型项目使用。 — https://lpplc.cn/wiki/manual/models/03-13-lp2222mt.html - 3.14 LP1616 [LP1616] — LP1616 是 LPPLC 系列里的经典**串口型** PLC 控制器(STM32F103 平台):16 入 16 出共 32 点, — https://lpplc.cn/wiki/manual/models/03-14-lp1616.html - 3.15 LP6666 软PLC(模拟器) [LP6666] — Linux 版目前云服务功能暂不可用,其余功能(PLC 运行、Lua 脚本、Modbus 等)均可正常使用。 — https://lpplc.cn/wiki/manual/models/03-15-lp6666.html - 3.16 LP8802 RS485 隔离转接器 [LP8802] — LP8802 是 **RS485 隔离转接器**:一路 RS485 输入,经两侧完全电气隔离后输出**一种**接口;按型号分为 **RS485(默认)/ RS232 / TTL** 三款,每款只出一种。它用来消除长距… — https://lpplc.cn/wiki/manual/models/03-16-lp8802.html - 机型总览 — LP3232 是三网合一机型:WiFi + 以太网 + 4G 三通道互为备份、自动切换(优先级 网口 > WiFi > 4G), — https://lpplc.cn/wiki/manual/models/ - 1.1 安全须知 — ::: danger 通电前,请务必先读完本页 — https://lpplc.cn/wiki/manual/quickstart/01-01-safety.html - 1.2 五分钟接线上电 — 让设备电源灯亮起,网口 / 串口 / 4G / WIFI 中至少有一路能通。预计耗时 5 分钟。 — https://lpplc.cn/wiki/manual/quickstart/01-02-wire-power-5min.html - 1.3 装工具并连上设备 — 在电脑上装好 LPPLC 上位机工具,选一种连接方式,让工具"看到"设备并读取到设备信息。 — https://lpplc.cn/wiki/manual/quickstart/01-03-install-connect.html - 1.4 从 FX3U 串口迁移到网口/WIFI — 以前用三菱 FX3U / FX2N,习惯了 SC-09 编程电缆 + 圆口 COM 连接。换到本机后需要重新确认几件事:网口如何连接、WIFI 如何配置、IP 如何设置、与串口连接有何区别。 — https://lpplc.cn/wiki/manual/quickstart/01-04-migrate-serial-to-ethernet-wifi.html - 1.5 学会了这些还能做什么 — 做完前面几个项目后,您已掌握这些底层技能: — https://lpplc.cn/wiki/manual/quickstart/01-05-what-next.html - 1.6 提一个功能建议 — 这台设备和这套云平台的许多功能,最初都来自客户的一句使用反馈。 — https://lpplc.cn/wiki/manual/quickstart/01-06-feature-request.html - 快速入门 · 把设备接起来 — 本篇只解决一件事:从零到设备能被电脑搜到、能上电跑起来。 — https://lpplc.cn/wiki/manual/quickstart/ - 2.1 串口透传给第三方设备编程 — 现场已有第三方仪表、变频器、触摸屏,需要用其原厂上位机软件编程或组态,但每次都要到现场插 USB 线,成本较高。 — https://lpplc.cn/wiki/manual/scenarios/02-01-serial-bridge-third-party.html - 2.2 远程编程 — 设备已安装在客户现场,程序只需改一行,往往也要专程跑一趟现场,时间与差旅成本高。 — https://lpplc.cn/wiki/manual/scenarios/02-02-remote-programming.html - 2.3 用 GX Works2 远程编辑设备 — 已习惯使用三菱 GX Works2,工程、操作习惯、快捷键都建立在它之上;更换为 LPPLC 设备后,希望继续使用 GX Works2 编辑,并支持远程操作。 — https://lpplc.cn/wiki/manual/scenarios/02-03-gworks2-remote.html - 2.4 MCGS 触摸屏连接 PLC — 现场普遍使用 MCGS 触摸屏(昆仑通态)。需要在触摸屏上通过按钮控制 LPPLC 设备的输出点,并显示 D 寄存器中的实时数据。 — https://lpplc.cn/wiki/manual/scenarios/02-04-mcgs-touchscreen-plc.html - 2.5 对接 MQTT 收发 JSON — 既要把设备数据以 JSON 格式发到 MQTT 服务器(EMQX / 阿里云 IoT / 自建 Mosquitto),后端也要能通过 MQTT 下发指令让设备执行,**上下行都需要打通**。 — https://lpplc.cn/wiki/manual/scenarios/02-05-mqtt-json.html - 2.6 对接 HTTP 上报与拉取数据 — 客户后端是传统 REST 服务,希望设备直接走 HTTP:定时 POST 上报数据,或者定时 GET 拉取配置和指令。比 MQTT 更简单直接,不用维护长连接。 — https://lpplc.cn/wiki/manual/scenarios/02-06-http-report-pull.html - 2.7 温度采集做一个云端看板 — 老板想在手机上看到车间每台设备的温度实时曲线,超温还要能收到报警。 — https://lpplc.cn/wiki/manual/scenarios/02-07-temp-dashboard.html - 2.8 让设备自己发报警邮件 — 设备在现场无人值守,出现异常(水位超限、温度过高、设备停机)时需要立刻收到邮件通知。不希望为此单独部署邮件服务,也不想在设备固件里实现 SMTP 认证和加密。 — https://lpplc.cn/wiki/manual/scenarios/02-08-alert-email.html - 场景配方 · 用项目学产品 — 每一篇都是一条**能独立跑通的端到端路线**:从接线联网开始,到设备真的把那件事做成为止。 — https://lpplc.cn/wiki/manual/scenarios/ ### plc - 什么是PLC编程 — LP系列可编程控制器(LPPLC)是一款**嵌入式PLC**,兼容**三菱FX3U指令体系**,用户可以使用GX Works2等主流编程软件进行开发,学习成本低、上手快。同时支持 Lua 脚本编程,本机内置网口 / … — https://lpplc.cn/wiki/plc/01-01-what-is-plc.html - 编程环境搭建 — LPPLC兼容三菱FX3U指令体系,推荐使用以下编程软件: — https://lpplc.cn/wiki/plc/01-02-environment-setup.html - 第一个梯形图程序 — 下面通过一个经典的**启停控制**示例,走一遍 PLC 编程的完整流程。 — https://lpplc.cn/wiki/plc/01-03-first-ladder.html - 梯形图基本概念 — 梯形图是仿传统继电器控制系统的电气原理图设计的一种编程方法,其核心概念如下: — https://lpplc.cn/wiki/plc/01-04-ladder-basics.html - 数值基本知识 — PLC内部采用二进制码处理数据,了解数值的基本概念对编程至关重要。 — https://lpplc.cn/wiki/plc/01-05-number-basics.html - 软元件一览 — PLC的软元件是程序操作的基本对象。以下是LP3U支持的软元件概览: — https://lpplc.cn/wiki/plc/01-06-devices-overview.html - 编程方式概览 — LP系列PLC支持多种编程方式,可按您的习惯自由选择: — https://lpplc.cn/wiki/plc/01-07-programming-methods.html - 通信功能 — LPPLC提供丰富的通信能力,支持串口和网口两种通信方式。 — https://lpplc.cn/wiki/plc/01-08-communication.html - LUA脚本开发 — WIFI 版、4G 版与三网版 PLC 都支持 Lua 脚本开发,与梯形图程序**并行运行**,实现 PLC 逻辑控制与物联网功能的深度融合。 — https://lpplc.cn/wiki/plc/01-09-lua-development.html - 扩展模块 — 点数不够时,从主机右侧的扩展口往外接扩展模块,扩展来的 X/Y/AI/AO 直接接在主机自带点位的后面,程序里当本机点位一样用,不需要额外配置。 — https://lpplc.cn/wiki/plc/01-10-expansion-modules.html - 写出可靠的梯形图程序 — 这一页讲的不是"某条指令怎么用",而是**一个程序整体该怎么写** —— — https://lpplc.cn/wiki/plc/01-11-writing-good-ladder.html - 02-00-instruction-quickref — 一页列全梯形图里可用的应用指令:助记符、功能、操作数、写法示例、占用步数、位宽(16 位还是 32 位)和 FNC 号。 — https://lpplc.cn/wiki/plc/02-00-instruction-quickref.html - 触点指令 — **注意**:D□.b 仅 LP3U 支持,且不能使用 V/Z 变址修饰。特殊辅助继电器(M8000+)和 32 位计数器(C200+)不能使用变址修饰。 — https://lpplc.cn/wiki/plc/02-01-contact-instructions.html - 块操作与栈操作 — 将两个回路块串联连接(块与)。无操作数。 — https://lpplc.cn/wiki/plc/02-02-block-stack-operations.html - 输出指令 — **注意**:OUT 不能用于输入继电器 X。对定时器和计数器,OUT 后须跟设定值(K/H/D)。 — https://lpplc.cn/wiki/plc/02-03-output-instructions.html - 取反与空操作 — 将 INV 指令之前的逻辑运算结果取反。无操作数。 — https://lpplc.cn/wiki/plc/02-04-invert-nop.html - 边沿检测 — **LPPLC 特有**:MEP/MEF 可以简化编程,避免为检测组合逻辑的边沿而额外分配辅助继电器。 — https://lpplc.cn/wiki/plc/02-05-edge-detection.html - 主控指令 — 当 MC 驱动条件为 ON 时,MC 到 MCR 之间的程序正常执行;为 OFF 时: — https://lpplc.cn/wiki/plc/02-06-master-control.html - 指令步数速查 — 上面这张表只管**位指令**(`LD`/`OUT`/`SET` 这类)。`MOV`、`CMP`、`ZRST` 这些**应用指令**另算: — https://lpplc.cn/wiki/plc/02-07-instruction-steps.html - 定时器 T — **注意**:D 的内容必须在定时器开始计时前设定好,计时过程中修改 D 值须到下次启动才生效。 — https://lpplc.cn/wiki/plc/03-01-timers.html - 计数器 C — U/D=增/减计数输入,U=增计数输入,D=减计数输入,A=A相,B=B相,R=复位输入,S=启动输入 — https://lpplc.cn/wiki/plc/03-02-counters.html - 一、程序流程(FNC 00-09) — **P63** 是特殊的 END 跳转指针,跳转到 P63 等同于跳转到 END 指令。 — https://lpplc.cn/wiki/plc/04-01-program-flow.html - 二、比较与传送(FNC 10-19) — X0=OFF 时不执行 CMP,M0~M2 保持之前状态。需 ≧、≦、≠ 时可串并联 M0~M2。 — https://lpplc.cn/wiki/plc/04-02-compare-transfer.html - 三、算术与逻辑运算(FNC 20-29) — 除数为 0 时运算错误。运算影响标志:M8020(零)、M8021(借位)、M8022(进位)。 — https://lpplc.cn/wiki/plc/04-03-arithmetic-logic.html - 四、中断 — 中断让 PLC 在扫描周期之外立即响应事件,不受扫描周期(通常几毫秒)的延迟影响。需要抓窄脉冲、做固定周期采样、或者在脉冲输出结束的瞬间做动作时,用中断。 — https://lpplc.cn/wiki/plc/04-04-interrupts.html - 循环与移位(FNC 30-39) — 这一族四条经常被当成"只差一个进位位",其实本机的 `RCR` / `RCL` 和三菱不是一回事: — https://lpplc.cn/wiki/plc/05-01-loop-shift.html - 数据处理(FNC 40-49) — 这条指令会**占用**您指定的那个定时器号,同一个定时器不要再拿去做别的计时。 — https://lpplc.cn/wiki/plc/05-02-data-processing.html - 高速处理(FNC 50-59) — **用途**:高速定位控制等需要即时 I/O 响应的场景。 — https://lpplc.cn/wiki/plc/05-03-high-speed.html - 便利指令(FNC 60-70) — **用途**:简化具有手动/步进/自动等多种操作模式的设备编程。 — https://lpplc.cn/wiki/plc/05-04-convenience.html - 外部设备 IO(FNC 72-79) — 外部设备 I/O 指令用于连接键盘、数码管等外设。 — https://lpplc.cn/wiki/plc/05-05-external-io.html - 通信指令(FNC 80-89) — **注意**:使用前需在系统参数中配置串口为"无协议"模式。 — https://lpplc.cn/wiki/plc/05-06-communication-instructions.html - 浮点数运算(FNC 110-137) — 本机浮点数一律占两个数据寄存器,所以这一族**只有 32 位形态**,三菱给的名字就是上表这一列(`DSIN`、`DEADD`…),不带 `D`。 — https://lpplc.cn/wiki/plc/05-07-float-operations.html - 数据处理与时钟(FNC 140-189) — ⚠️ 本机型运行时这条不做任何动作,写法仅供对照三菱程序。替代做法用 `DRVI` / `DRVA`。 — https://lpplc.cn/wiki/plc/05-08-data-clock.html - 块运算与字符串(FNC 190-219) — 这一段是 FX3U 里比较少用但很实用的部分:**块运算**让您对一整片 D 寄存器做加减和比较,**字符串指令**让 PLC 能直接拼接、截取、查找 ASCII 字符串(做报文、做屏幕显示时很省事)。 — https://lpplc.cn/wiki/plc/05-09-block-string.html - 触点比较与数据处理(FNC 224-299) — ⚠️ 本机型运行时这条不做任何动作,写法仅供对照三菱程序。 — https://lpplc.cn/wiki/plc/05-10-contact-compare.html - 五、32 位扩展指令详解(带 D 的写法) — 本章补充说明速查总表中没有独立详解页的 32 位写法(带 `D` 的应用指令)。这些指令的功能与不带 `D` 的同名指令相同,只是每个操作数按 32 位(双字)处理。 — https://lpplc.cn/wiki/plc/05-11-dword-instructions.html - 特殊辅助继电器一览(M8000~M8511) — 本设备把 M8000~M8511 / D8000~D8511 这一段留给系统,下表列出说明书点名的全部 M8xxx 位置 — https://lpplc.cn/wiki/plc/06-01-special-relays.html - 特殊数据寄存器一览(D8000~D8511) — 本设备把 M8000~M8511 / D8000~D8511 这一段留给系统,下表列出说明书点名的全部 D8xxx 位置 — https://lpplc.cn/wiki/plc/06-02-special-registers.html - 部分特殊软元件详细说明 — D8005 的每一位反映 PLC 的硬件驱动及连接状态: — https://lpplc.cn/wiki/plc/06-03-special-devices-detail.html - PLC 与 Lua 协同 — 详细用法参见 PLC 数据交互(plc 模块) — https://lpplc.cn/wiki/plc/06-04-plc-lua-coordination.html - 出错检测机制概述 — 当 PLC 检测到任何错误时: — https://lpplc.cn/wiki/plc/07-01-error-detection-overview.html - 系统错误 — M8060 / D8060 — **当前版本不检测这一类错误。** 程序引用了未安装的扩展模块 I/O 地址时,`M8060` 不会点亮、`D8060` 保持 `0`,也不会有任何报警。这一页保留是为了与三菱 FX3U 的诊断口径对照。 — https://lpplc.cn/wiki/plc/07-02-m8060-system-error.html - 硬件错误 — M8061 / D8061 — PLC 硬件异常,**PLC 停止运行。** — https://lpplc.cn/wiki/plc/07-03-m8061-hardware-error.html - 通信错误 — M8062 / D8062 — `E62101`:确保 PLC 的 IP 地址与局域网内其它设备不重复。`E62102`:检查目标设备是否在线。 — https://lpplc.cn/wiki/plc/07-04-m8062-comm-error.html - 通信出错 — M8063 / D8063 — RS-485/串口通信异常,**PLC 继续运行。** — https://lpplc.cn/wiki/plc/07-05-m8063-comm-error.html - 参数出错 — M8064 / D8064 — 停止 PLC 运行后,用参数方式重新设定正确值即可清除。 — https://lpplc.cn/wiki/plc/07-06-m8064-param-error.html - 语法出错 — M8065 / D8065 — 程序语法错误,**PLC 停止运行。** — https://lpplc.cn/wiki/plc/07-07-m8065-syntax-error.html - 电路出错 — M8066 / D8066 — 修改指令间的相互关系,确保电路结构正确后重新下载程序即可清除。 — https://lpplc.cn/wiki/plc/07-08-m8066-circuit-error.html - 运算出错 — M8067 / D8067 — 应用指令运算错误,**PLC 继续运行。** — https://lpplc.cn/wiki/plc/07-09-m8067-math-error.html - 错误清除方法 — 上表列出的是 8 类错误的通用清除方式。各款机型实际会检测哪几类、以及 `D806x` 读到 `0` 该怎么理解,见 7.1 出错检测机制概述。 — https://lpplc.cn/wiki/plc/07-10-error-clearing.html - 一、简单工程使用标签(程序分段) — LPPLC 支持三种编程方式,本节讲第一种。三者的定位和适用场景先看这张图: — https://lpplc.cn/wiki/plc/08-01-simple-project-labels.html - 二、功能块图/梯形图(FBD/LD) — 这是三种编程方式里最常用的一种。把反复用到的逻辑(比如一段 PID、一段报警判断)封装成功能块,之后在梯形图里像元件一样调用,改一处就能全部生效。 — https://lpplc.cn/wiki/plc/08-02-fb-in-ladder.html - 三、ST 语言编程 — ST 是三种编程方式之一。梯形图画不清楚的复杂算法(多重条件判断、循环运算),用 ST 几行就能写完;主体逻辑仍可用梯形图,两者可以混用。 — https://lpplc.cn/wiki/plc/08-03-st-language.html - 9.1 常用解决方案 — 这里是速查版。完整的实战教程(含多机轮询示例、心跳判断在线、排查顺序)见 **9.6 多机通讯**。 — https://lpplc.cn/wiki/plc/09-01-common-solutions.html - 9.2 GX Works2 网口连接 — ::: tip 本节已合并 — https://lpplc.cn/wiki/plc/09-02-gxworks2-ethernet.html - 9.3 远程外网编程 — ::: tip 本节已合并 — https://lpplc.cn/wiki/plc/09-03-remote-programming.html - 9.4.0 MCGS Pro 连接 LPPLC — MCGS Pro(昆仑通态)连接 LPPLC **只要两步**:先在 PLC 里用一句 Lua 打开 MC 服务,再在 MCGS Pro 里填对 IP 和端口,就能连上。整个过程 1 分钟。 — https://lpplc.cn/wiki/plc/09-04-0-mcgs-pro.html - 9.4.1 MCGS 嵌入版 7.7 连接 LPPLC — MCGS 嵌入版(昆仑通态)有四种接法,按您现场的接线方式挑一种: — https://lpplc.cn/wiki/plc/09-04-1-mcgs-embedded.html - 9.4.2 MCGS 通用版 6.2 连接 LPPLC — MCGS 通用版走网口 Modbus,PLC 端不用改设置。 — https://lpplc.cn/wiki/plc/09-04-2-mcgs-universal.html - 9.4.3 组态王连接 LPPLC — 组态王(KingView)有三种接法: — https://lpplc.cn/wiki/plc/09-04-3-kingview.html - 9.4.4 三菱 GS2107-WTBD(GT Designer3)连接 LPPLC — 返回 组态软件/触摸屏连接总览 — https://lpplc.cn/wiki/plc/09-04-4-mitsubishi-gs2107.html - 9.4.5 威纶通 EasyBuilder8000 连接 LPPLC — EasyBuilder8000 有三种接法: — https://lpplc.cn/wiki/plc/09-04-5-easybuilder8000.html - 9.4.6 VT Designer / OP320 连接 LPPLC — - VT Designer V2.1 · 网口 — https://lpplc.cn/wiki/plc/09-04-6-vtdesigner-op320.html - 9.4 与组态软件/触摸屏连接 — LPPLC 兼容多种主流组态软件和触摸屏。**在下表里找到您的软件,点后面的链接直接进对应教程。** — https://lpplc.cn/wiki/plc/09-04-hmi-touchscreen.html - 9.5.1 用新版上位机工具升级(ESP32 / RDA8910 版) — ESP32 / RDA8910 版(LP32xx、LP8910)应使用**新版上位机工具**升级,流程比 STM32 版简单:**不需要先切换到升级模式**。 — https://lpplc.cn/wiki/plc/09-05-1-upgrade-with-tool.html - 9.5.2 通过云平台远程升级 — 设备接入云服务后,可以在 **云平台网页(www.lpplc.cn)** 上远程升级固件,无需到现场,也不要求与设备处于同一局域网。仅 ESP32 / RDA8910 版支持。 — https://lpplc.cn/wiki/plc/09-05-2-cloud-upgrade.html - 9.5 PLC 网口升级固件(STM32 版) — LPPLC 功能不断升级和完善,欢迎使用最新固件程序。 — https://lpplc.cn/wiki/plc/09-05-firmware-upgrade-ethernet.html - 9.6 多机通讯(PLC 之间直接交换数据) — 多机通讯是 LPPLC 自带的一套 **PLC 与 PLC 之间直接交换 D 区数据**的功能,走 UDP,**STM32 版和 ESP32 版都支持**。 — https://lpplc.cn/wiki/plc/09-06-multi-plc-network.html - 例程总览 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 梯形图**完整可运行**例程汇总。每段都包含:场景、IL 代码(与梯形图一一对应)、要点、验证方法、注意事项。 — https://lpplc.cn/wiki/plc/b-00-example-overview.html - 基本回路例程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 梯形图最常用的 6 个基础回路。每段都是**完整可运行**的程序,可直接录入或导入上位机。 — https://lpplc.cn/wiki/plc/b-01-basic-circuits.html - 定时与计数例程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 定时器与计数器的典型应用。代码为 IL 指令文本,与梯形图一一对应。 — https://lpplc.cn/wiki/plc/b-02-timer-counter.html - 应用指令例程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 应用指令(FNC 10~59)的 6 个常用做法:比较传送、参数初始化、四则运算、移位队列、批量复位、高速计数测速。 — https://lpplc.cn/wiki/plc/b-03-application-instructions.html - 模拟量与浮点例程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 本机 AI/AO 读写、工程量换算、浮点运算与回差控制。 — https://lpplc.cn/wiki/plc/b-04-analog-float.html - 通信与 Lua 协同例程 [LP3202 LP3203 LP3222 LP3232 LP3288 LP8910 LP6666] — 梯形图管**实时 I/O 与安全联锁**,Lua 管**网络与协议**,两边通过 D 寄存器和 M 位共享数据。 — https://lpplc.cn/wiki/plc/b-05-comm-lua.html - 综合场景例程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 6 个完整的现场小工程:交通灯、传送带分拣、一用一备轮换、故障报警与复位、自动/手动切换、进出计数。 — https://lpplc.cn/wiki/plc/b-06-integrated-scenarios.html - MODBUS 串口通讯例程 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 LP2252MT LP2252MR LP2250MT LP2250MR LP2229MT LP2222MR] — 用梯形图把本机的 RS-485 串口配成 MODBUS **从站**(让其他设备读取本机),或者配成**主站**去读别的设备。 — https://lpplc.cn/wiki/plc/b-07-modbus-serial.html - B8. 梯形图 Modbus 多路轮询框架 [LP3201 LP3202 LP3203 LP3222 LP3232 LP3288 软PLC模拟器 上位机] — 梯形图例程。Modbus 串口指令见 `05-06 通信指令`;完整 Modbus 例程见 `B7`。 — https://lpplc.cn/wiki/plc/b-08-modbus-multi-poll.html - PLC 编程 — LPPLC 系列设备支持三菱 FX 兼容的梯形图编程。您可以使用梯形图完成逻辑控制、定时计数、数据运算等典型 PLC 任务,同时享受 LPPLC 提供的网络通信、远程监控和 Lua 脚本扩展能力。 — https://lpplc.cn/wiki/plc/ ### scada - 01-01-what-can-it-do — LPPLC 云组态是一个可视化组态设计工具,让您通过拖拽组件、绑定数据,快速搭建工业监控界面。 — https://lpplc.cn/wiki/scada/01-01-what-can-it-do.html - 01-02-enter-management — **入口路径**:登录 LPPLC 云平台 → 左侧菜单「组态管理」 — https://lpplc.cn/wiki/scada/01-02-enter-management.html - 01-03-first-project — 下面每一步都配了实际界面截图,照着做即可。 — https://lpplc.cn/wiki/scada/01-03-first-project.html - 01-04-drag-save-preview — 1. **拖入组件** — https://lpplc.cn/wiki/scada/01-04-drag-save-preview.html - 01-05-publish-share — 1. 回到**组态列表页**,在对应工程的操作里点「发布」(编辑器工具栏内没有发布按钮) — https://lpplc.cn/wiki/scada/01-05-publish-share.html - 01-06-summary-roadmap — - 云组态 = 拖拽组件 + 绑定数据 + 发布分享 — https://lpplc.cn/wiki/scada/01-06-summary-roadmap.html - 02-01-layout-overview — 设计器采用经典的三栏布局: — https://lpplc.cn/wiki/scada/02-01-layout-overview.html - 02-02-toolbar — 多选 3 个及以上组件时,为腾出空间,撤销 / 恢复 / 清空这类常驻按钮会临时隐藏,工具条切换成对齐操作为主。 — https://lpplc.cn/wiki/scada/02-02-toolbar.html - 02-03-component-library — 定制组件标签页会按账号做过滤,部分为特定客户专用组件,普通账号看不到。 — https://lpplc.cn/wiki/scada/02-03-component-library.html - 02-04-canvas — 画布是组态设计的核心工作区域。 — https://lpplc.cn/wiki/scada/02-04-canvas.html - 02-05-property-panel — 右侧面板顶部是标签页,会**根据当前选中的对象自动切换**。一共有 7 个标签页,其中「图层」「页面」「工程」「变量」始终存在。 — https://lpplc.cn/wiki/scada/02-05-property-panel.html - 02-06-efficiency-tips — - 按住 Alt 拖动可精确微调位置(每次 1 像素) — https://lpplc.cn/wiki/scada/02-06-efficiency-tips.html - 03-01-display-components — **数据绑定**:通过「显示事件 → 显示值」绑定数据点,运行时自动将文本内容替换为数据点当前值。 — https://lpplc.cn/wiki/scada/03-01-display-components.html - 03-02-chart-components — 所有图表组件均基于 ECharts,数据绑定后实时刷新。 — https://lpplc.cn/wiki/scada/03-02-chart-components.html - 03-03-control-components — 开关是**双向绑定**:拨动会写数据点,数据点被别处改了开关也会跟着变。 — https://lpplc.cn/wiki/scada/03-03-control-components.html - 03-04-indicator-components — 这四个组件都在组件库「基本组件 → 嵌入」子分组下,用来做画面的图形底子和状态表现。 — https://lpplc.cn/wiki/scada/03-04-indicator-components.html - 03-05-special-components — 这五个是"重量级"嵌入组件,都在「基本组件 → 嵌入」子分组下。 — https://lpplc.cn/wiki/scada/03-05-special-components.html - 03-06-html-component — 这些组件在组件库「其它组件」标签页下,基于原生 HTML 控件实现,样式更贴近网页习惯。 — https://lpplc.cn/wiki/scada/03-06-html-component.html - 03-07-drawing-components — 组件库「绘制组件」标签页,用来画背景框、分隔线、工艺流程底图。 — https://lpplc.cn/wiki/scada/03-07-drawing-components.html - 03-08-custom-components — 这个标签页会按账号过滤:部分组件为特定客户专用,普通账号不可见。 — https://lpplc.cn/wiki/scada/03-08-custom-components.html - 04-01-binding-principles — 数据绑定是云组态的核心功能,实现「画面」与「设备数据」的联动。 — https://lpplc.cn/wiki/scada/04-01-binding-principles.html - 04-02-datapoint-picker — 上图中编号格填的是 `D0`,于是拼成了 `@11315751.DD0.S16`——`DD0` 不是有效寄存器,画面会一直取不到值。正确填法是编号格只写 `0`。 — https://lpplc.cn/wiki/scada/04-02-datapoint-picker.html - 04-03-display-events — 下拉列表只显示当前还能添加的类型,已添加过的互斥项会自动从列表中隐藏。 — https://lpplc.cn/wiki/scada/04-03-display-events.html - 04-04-click-events — 下拉列表只显示当前还可添加的类型:已添加过的互斥项(如全屏切换、执行脚本)会从列表中消失。 — https://lpplc.cn/wiki/scada/04-04-click-events.html - 04-05-expression-syntax — 注意:表达式中不能使用 `/` 除号(因变量名可包含 `/`),需要除法时改写为乘以倒数(如 除2 写成 `*0.5`)。 — https://lpplc.cn/wiki/scada/04-05-expression-syntax.html - 04-06-binding-scenarios — 1. 拖入文本组件 — https://lpplc.cn/wiki/scada/04-06-binding-scenarios.html - 04-07-binding-debug — 1. **预览模式验证** — https://lpplc.cn/wiki/scada/04-07-binding-debug.html - 05-01-animation-config — 动画让组态画面更生动。LP 云组态基于 Animate.css 提供丰富的动画效果。 — https://lpplc.cn/wiki/scada/05-01-animation-config.html - 05-02-event-config — 注意:脚本运行在受限沙箱中(使用 `new Function` 而非 `eval`),只有上表列出的函数可用。`alert()`、`getTag()`、`setTag()` 等均不存在。 — https://lpplc.cn/wiki/scada/05-02-event-config.html - 05-03-practice-button-control — **场景**:在画面上放一个按钮,点一下把 PLC 的 Y0 输出点置 1(启动);再放一个文本, — https://lpplc.cn/wiki/scada/05-03-practice-button-control.html - 05-04-practice-alarm-blink — 1. 拖入指示灯组件 — https://lpplc.cn/wiki/scada/05-04-practice-alarm-blink.html - 05-05-event-animation-combo — **组合思路**:数据变化 → 触发事件 → 改变属性 + 播放动画 — https://lpplc.cn/wiki/scada/05-05-event-animation-combo.html - 05-06-checklist — - [ ] 能为组件添加入场动画 — https://lpplc.cn/wiki/scada/05-06-checklist.html - 06-01-device-datapoints — 在 LP 云组态中,画面显示的数据来源于**设备数据点**。 — https://lpplc.cn/wiki/scada/06-01-device-datapoints.html - 06-02-realtime-binding — 实时数据绑定让画面显示设备当前值。 — https://lpplc.cn/wiki/scada/06-02-realtime-binding.html - 06-03-history-datasource — 列表中的「瞬时型上传存盘」为已弃用选项,新工程不要再选。 — https://lpplc.cn/wiki/scada/06-03-history-datasource.html - 06-04-update-mechanism — - WebSocket 长连接,数据点值一变,服务器立刻主动推给正在看这个画面的浏览器 — https://lpplc.cn/wiki/scada/06-04-update-mechanism.html - 07-01-preview — 预览功能让您在发布前检查画面效果。 — https://lpplc.cn/wiki/scada/07-01-preview.html - 07-02-publish-settings — 发布组态后,其他用户可通过链接访问。 — https://lpplc.cn/wiki/scada/07-02-publish-settings.html - 07-03-access-control — 组态画面没有「公开 / 私有」开关,也不需要登录账号。访问与否只取决于一件事 —— **工程属性里有没有配置访问密码**: — https://lpplc.cn/wiki/scada/07-03-access-control.html - 07-04-pwa-install — iOS 不支持自动安装提示,需要手动操作。 — https://lpplc.cn/wiki/scada/07-04-pwa-install.html - 07-05-export-import — 将组态工程保存为 JSON 文件,用于备份或迁移: — https://lpplc.cn/wiki/scada/07-05-export-import.html - 07-06-project-list — 登录 LP 云平台后,点击顶部导航「WEB云组态」→「我的组态」,进入组态列表页面。 — https://lpplc.cn/wiki/scada/07-06-project-list.html - 07-07-product-scada — 假设您做了 100 台一模一样的设备卖给客户,每台都要一个手机监控画面。 — https://lpplc.cn/wiki/scada/07-07-product-scada.html - 08-01-case-pump-monitor — 1. 拖入指示灯,绑定 `pump_run`,配置「背景色」显示事件 — https://lpplc.cn/wiki/scada/08-01-case-pump-monitor.html - 08-02-case-warehouse-temp-humidity — 1. 拖入文本,绑定 `zone1.temp`,单位 `°C` — https://lpplc.cn/wiki/scada/08-02-case-warehouse-temp-humidity.html - 08-03-case-production-dashboard — 1. 顶部放置标题文本「产线综合看板」 — https://lpplc.cn/wiki/scada/08-03-case-production-dashboard.html - 09-01-event-trigger-intro — 事件触发让云平台**在您没打开网页的时候也持续监视数据**:数据一超限就自动发邮件、自动往 PLC 写值、自动留一条记录。 — https://lpplc.cn/wiki/scada/09-01-event-trigger-intro.html - 09-02-event-trigger-manage — 点击左侧菜单「事件触发」进入列表页,结构与组态管理页面一致: — https://lpplc.cn/wiki/scada/09-02-event-trigger-manage.html - 09-03-node-types — 左侧节点面板按三级分组,把节点拖到画布上即可使用。 — https://lpplc.cn/wiki/scada/09-03-node-types.html - 09-04-practice-email-alert — 收到邮件说明整条链路(触发 → 判断 → 发邮件)已经打通。如果一直收不到,先用「测试运行」看是哪个节点没过,再检查邮件节点的收件人和服务器的发件配置。 — https://lpplc.cn/wiki/scada/09-04-practice-email-alert.html - 09-05-multi-conditions — **任意一个触发条件成立,就以"这次是它触发的"为前提,把整张流程图算一遍。** — https://lpplc.cn/wiki/scada/09-05-multi-conditions.html - a-01-shortcuts — 注意:不存在 Ctrl+P(预览)和 Ctrl+加号/减号(缩放)快捷键。预览通过工具栏按钮触发,缩放通过工具栏或鼠标滚轮操作。 — https://lpplc.cn/wiki/scada/a-01-shortcuts.html - a-02-expression-quickref — 注意:表达式中不能使用 `/` 除号(因变量名可包含 `/`),需要除法时改写为乘以倒数(如 除2 写成 `*0.5`)。 — https://lpplc.cn/wiki/scada/a-02-expression-quickref.html - a-03-component-table — --- — https://lpplc.cn/wiki/scada/a-03-component-table.html - a-04-faq-index — - 画布上没有任何组件 — https://lpplc.cn/wiki/scada/a-04-faq-index.html - a-05-troubleshooting-flow — 1. **检查网络连接** → 网络正常? — https://lpplc.cn/wiki/scada/a-05-troubleshooting-flow.html - a-06-changelog — - 全新三栏布局编辑器 — https://lpplc.cn/wiki/scada/a-06-changelog.html - WEB云组态使用手册 — **本手册将帮助您从零开始学习使用 LPPLC 云组态,创建专业的工业监控界面。** — https://lpplc.cn/wiki/scada/ ### server - 01-01-what-can-it-do — LPPLC 服务器是工业物联网数据中枢,为设备接入、数据存储和第三方系统集成提供一站式服务能力。 — https://lpplc.cn/wiki/server/01-01-what-can-it-do.html - 01-02-architecture — LPPLC 服务器采用 IOCP 高性能网络架构,核心服务并行运行: — https://lpplc.cn/wiki/server/01-02-architecture.html - 01-03-protocol-guide — 根据实际需求选择合适的对接协议: — https://lpplc.cn/wiki/server/01-03-protocol-guide.html - 02-01-install-start — LPPLC 服务器为绿色软件,解压即可运行。 — https://lpplc.cn/wiki/server/02-01-install-start.html - 02-02-ports-firewall — 服务器默认监听以下端口: — https://lpplc.cn/wiki/server/02-02-ports-firewall.html - 02-03-https-cert — LPPLC 服务器支持 HTTPS 加密访问,需配置 SSL 证书。 — https://lpplc.cn/wiki/server/02-03-https-cert.html - 02-04-db-init — LPPLC 服务器使用 SQLite3 嵌入式数据库,首次启动自动创建。 — https://lpplc.cn/wiki/server/02-04-db-init.html - 03-01-cloud-access-overview — 本页是对接前的方案选择依据。对接 LPPLC 服务器,第一个要决定的是:现场的数据用哪条通道送到服务器上。 — https://lpplc.cn/wiki/server/03-01-cloud-access-overview.html - 03-02-dtu-datapoints — 这是 LP 系列 PLC 上云的标准做法,**不需要编写代码**:在上位机里把 PLC 的寄存器和云端数据点一条条绑起来,设备就会自动把值同步到服务器。 — https://lpplc.cn/wiki/server/03-02-dtu-datapoints.html - 03-03-lua-cloud — 方式一(DTU 云交互)是配置驱动的,配置量小。以下情况需要改用脚本: — https://lpplc.cn/wiki/server/03-03-lua-cloud.html - 03-04-scada-direct-registers — 前面三种方式都是「数据先进实时数据库,画面再从数据库取」。这一种不一样:**云组态画面直接读写 PLC 寄存器,不经过实时数据库**。 — https://lpplc.cn/wiki/server/03-04-scada-direct-registers.html - 03-05-plc-server-config — LPPLC 服务器内置 PLC Server,支持三菱 FX 协议,允许 PLC 设备通过 TCP 网络接入服务器,实现远程数据采集与监控。 — https://lpplc.cn/wiki/server/03-05-plc-server-config.html - 04-01-api-auth — LPPLC 服务器对外只暴露 HTTP POST 端点,**没有 REST 风格的多路径设计,也没有 `/api/` 前缀**。所有操作都往同一个地址 POST 一段 JSON,用 JSON 里的 `cmd` 字段区… — https://lpplc.cn/wiki/server/04-01-api-auth.html - 04-02-scada-management-api — 组态相关操作统一通过 `POST /web` 调用,`cmd` 字段指定具体动作,`username`/`password` 用于认证(详见 4.1)。 — https://lpplc.cn/wiki/server/04-02-scada-management-api.html - 04-03-realtime-api — 注意区分:本接口的值是字符串,而 4.3.6 的 `plc_data_read` 直接返回数字。两个接口的取值写法不一样。 — https://lpplc.cn/wiki/server/04-03-realtime-api.html - 04-04-history-api — 历史数据通过 `POST /web`、`cmd` 为 `data_hisload_list` 获取。 — https://lpplc.cn/wiki/server/04-04-history-api.html - 读取两个数据点 — 完整可运行的对接示例。所有请求都是 `POST /web`,body 是带 `cmd` 的 JSON,认证靠 body 里的 `username`/`password`(详见 4.1)。 — https://lpplc.cn/wiki/server/04-05-examples.html - 04-06-device-http-report — 前面几节是「后台程序调服务器接口」。这一节反过来:**设备主动用 HTTP 把数据 POST 到服务器**,作为 MQTT 之外的另一条上云通道。 — https://lpplc.cn/wiki/server/04-06-device-http-report.html - 05-01-mqtt-broker — LPPLC 服务器内置 MQTT Broker,支持 MQTT v3.1/v3.1.1 协议。 — https://lpplc.cn/wiki/server/05-01-mqtt-broker.html - 05-02-data-bus — LPPLC 内置 MQTT Broker 直接充当数据总线:MQTT 主题名对应实时数据库中的数据点名,无需额外映射配置。 — https://lpplc.cn/wiki/server/05-02-data-bus.html - 上报一个值 — 任何支持 MQTT 3.1 / 3.1.1 的设备或程序都能接入,不限品牌和语言。整个流程只有三步:连接、发布、(可选)订阅。 — https://lpplc.cn/wiki/server/05-03-device-access.html - 上报单个值 — 下面的示例都遵循 5.5 消息格式规范:主题名即数据点名,payload 用裸值。 — https://lpplc.cn/wiki/server/05-04-pub-sub-examples.html - 05-05-message-format — 本节说明 MQTT payload 与数据点的映射规则。设备 publish 一条消息后,服务器会按一套固定规则把 payload 拆开写进实时数据库。规则不复杂,但不了解会产生意料之外的数据点。 — https://lpplc.cn/wiki/server/05-05-message-format.html - 05-06-device-to-device — 除了「设备上报、云端查看」,内置 Broker 也可以当**设备之间的消息中转**用:A 设备 publish,B 设备 subscribe,不需要经过任何业务代码。 — https://lpplc.cn/wiki/server/05-06-device-to-device.html - 05-07-scada-mqtt-vars — 前面几节讲的都是「设备 publish 到服务器 Broker,服务器落库,云组态用项目变量读」。云组态还有另一条路:**画面直接连 MQTT Broker**,用 `#` 前缀的变量订阅/发布主题。 — https://lpplc.cn/wiki/server/05-07-scada-mqtt-vars.html - 06-01-server-config — LPPLC 服务器内置 Modbus TCP Server,可将内部数据点以标准 Modbus 协议暴露给外部系统。 — https://lpplc.cn/wiki/server/06-01-server-config.html - 06-02-register-mapping — LPPLC 服务器将内部数据点映射为标准 Modbus 寄存器,供外部 SCADA 系统读写。 — https://lpplc.cn/wiki/server/06-02-register-mapping.html - 06-03-client-examples — 外部 Modbus TCP 客户端连接 LPPLC 服务器时,首次请求即为鉴权请求。 — https://lpplc.cn/wiki/server/06-03-client-examples.html - 06-04-scada-integration — 将 LPPLC 作为 Modbus TCP 从站,对接主流 SCADA 系统。 — https://lpplc.cn/wiki/server/06-04-scada-integration.html - 07-01-websocket-config — WebSocket 是获取实时数据点变化的推荐方式:**服务器主动推送,不用轮询**。 — https://lpplc.cn/wiki/server/07-01-websocket-config.html - 07-02-push-mechanism — 1. 客户端按当前页面协议建立 WebSocket 连接到 `/ws`(握手阶段不做认证) — https://lpplc.cn/wiki/server/07-02-push-mechanism.html - 07-03-frontend-examples — 一个完整的、可直接改用的原生 JavaScript 接入示例,包含协议自适应、订阅、断线重连、重新订阅。 — https://lpplc.cn/wiki/server/07-03-frontend-examples.html - 08-01-service-status — 服务器主界面提供各服务的实时状态监控。 — https://lpplc.cn/wiki/server/08-01-service-status.html - 08-02-log-analysis — 服务器日志记录各服务的运行状态和错误信息。 — https://lpplc.cn/wiki/server/08-02-log-analysis.html - 08-03-performance-monitoring — LPPLC 服务器运行性能监控和调优建议。 — https://lpplc.cn/wiki/server/08-03-performance-monitoring.html - 08-04-db-backup — LPPLC 数据库的备份和恢复方法。 — https://lpplc.cn/wiki/server/08-04-db-backup.html - 08-05-troubleshooting — LPPLC 服务器常见故障的排查流程。 — https://lpplc.cn/wiki/server/08-05-troubleshooting.html - a-01-ports-quickref — LPPLC 服务器各服务默认端口如下: — https://lpplc.cn/wiki/server/a-01-ports-quickref.html - a-02-error-codes — 业务成功与否看响应体的 `cmdreq` 字段,不看 HTTP 状态码(业务失败时状态码通常仍是 200)。 — https://lpplc.cn/wiki/server/a-02-error-codes.html - a-03-config-files — LPPLC 服务器通过 Windows 注册表存储部分配置,路径: — https://lpplc.cn/wiki/server/a-03-config-files.html - a-04-faq-index — - 端口被占用怎么办?→ 2.2 端口与防火墙配置 — https://lpplc.cn/wiki/server/a-04-faq-index.html - 服务器数据对接 — 本手册说明两件事:怎么把现场数据送到 LPPLC 服务器,以及怎么从服务器把数据取出来供其它系统使用。 — https://lpplc.cn/wiki/server/ ### tool - 1.1 新版上位机简介 — 老版上位机是 2015 年的产物,构架已不能适应现有产品线:Lua 脚本从几个函数扩展成成套的库体系,PLC 从单串口发展到网口 / WiFi / 4G / LoRa 全系支持,还需接入云服务、实现远程编程。老构架中… — https://lpplc.cn/wiki/tool/01-01-introduction.html - 1.2 安装与首次启动 — 1. 从 www.lpplc.cn 下载新版上位机安装包 — https://lpplc.cn/wiki/tool/01-02-install-first-launch.html - 1.3 主界面导览 — 主界面分四块:顶部工具栏、左侧设备列表、右侧设备详情、底部操作日志。 — https://lpplc.cn/wiki/tool/01-03-main-window-tour.html - 1.4 新用户向导与求助入口 — 软件内置了一套 9 步向导和三个求助入口。不记得某个功能在哪里、或者接手一台没玩过的设备时,靠这几个东西就能找到路,不用翻文档。 — https://lpplc.cn/wiki/tool/01-04-wizard-help.html - 2.1 搜索设备的五种方式 — 点顶部「🔍 搜索设备」后,上位机会同时用五种方式并行查找设备,先应答的设备先显示。 — https://lpplc.cn/wiki/tool/02-01-search-devices.html - 2.2 设备列表与筛选 — 设备数 **≥ 6** 时,列表顶部出现过滤框,输入内容会同时匹配名称 / 序列号 / IP / 型号,输入一部分即可。 — https://lpplc.cn/wiki/tool/02-02-device-list-filter.html - 2.3 子网不匹配与修改 IP — UDP 广播能跨网段找到设备,但编程、下载、在线监视这些操作要求与设备处于同一网段。因此出厂 IP 为 `192.168.1.100` 的设备,接入 `192.168.31.x` 的网络能被搜到,却无法连接。 — https://lpplc.cn/wiki/tool/02-03-subnet-mismatch-ip.html - 2.4 UDP 被限制时用 TCP 找设备 — 点「🔍 搜索设备」**一台都搜不到**,但设备本身是正常的: — https://lpplc.cn/wiki/tool/02-04-tcp-fallback-discovery.html - 3.1 设备参数页总览 — 选中设备后,右侧的标签页不是固定的:上位机会向设备查询其支持的功能,然后只显示支持的页。因此不同型号看到的标签数量不同,这是正常现象。 — https://lpplc.cn/wiki/tool/03-01-device-params-overview.html - 3.2 网口与 WiFi 参数 — 填完点「写入配置」,重启设备生效。 — https://lpplc.cn/wiki/tool/03-02-ethernet-wifi.html - 3.3 串口、4G 与 LoRa — 支持多路串口,每路一张卡片。卡片上的字段是:模式、波特率、校验位、数据位、停止位、站号。 — https://lpplc.cn/wiki/tool/03-03-serial-4g-lora.html - 3.4 云服务与远程编程 — 设备接入云服务后才能使用数据上云、云组态画面、远程编程、远程透传等功能。本页用于配置云服务参数。 — https://lpplc.cn/wiki/tool/03-04-cloud-remote.html - 3.5 寄存器操作与设备日志 — 这两个标签不修改配置,用于在线查看数据和调试程序。 — https://lpplc.cn/wiki/tool/03-05-registers-logs.html - 3.6 DTU 功能(入口) — 「DTU 功能」页是 DTU 配置式编程 的入口:不写代码,勾选填表就能让设备采集仪表、上云、转发数据、做条件报警。 — https://lpplc.cn/wiki/tool/03-06-dtu.html - 3.7 远程串口透传(免 Lua) — **一句话理解**:设备 COM 口 ⇄ 云 ⇄ 上位机工具虚拟串口 ⇄ PC 应用。 — https://lpplc.cn/wiki/tool/03-07-remote-serial-bridge.html - 3.8 设备定位标注 — 「定位」页用来把设备的安装位置标在地图上,并把这组坐标**写进设备自己掉电不丢的存储里**。 — https://lpplc.cn/wiki/tool/03-08-location.html - 4.1 编辑器窗口总览 — 写程序有三个**独立窗口**,各开各的、互不影响: — https://lpplc.cn/wiki/tool/04-01-editor-windows.html - 4.2 工程管理与文件格式 — 新版上位机的工程是一个普通文件夹,里面全是纯文本: — https://lpplc.cn/wiki/tool/04-02-project-files.html - 4.3 绘制梯形图 — 新版编辑器的梯形图是**图形化**的:从工具栏点选元件、或直接从右侧「指令」面板拖进画布,兼容三菱 FX3U 指令集。 — https://lpplc.cn/wiki/tool/04-03-draw-ladder.html - 4.4 编译、下载与上载 — - 按 `F4`,或点梯形图工具栏的编译按钮,或菜单 `工具 → 编译` — https://lpplc.cn/wiki/tool/04-04-compile-download-upload.html - 4.5 工作模式与在线监视 — 梯形图编辑器和 GX Works2 一样分三种模式,用工具栏按钮或快捷键切换: — https://lpplc.cn/wiki/tool/04-05-run-monitor.html - 4.6 支持的指令一览 — 新版编辑器兼容**三菱 FX3U 指令集**。指令的详细语法、参数含义和用法示例请看 PLC 编程,这里只列上位机里支持哪些。 — https://lpplc.cn/wiki/tool/04-06-instruction-list.html - 5.1 Lua 脚本编辑器 — 新版上位机的 Lua 编辑器基于 **Monaco**(VS Code 用的那个编辑器内核),有自动补全、语法检查、格式化、跳转定义。 — https://lpplc.cn/wiki/tool/05-01-lua-editor.html - 6.1 PLC 在线操作与诊断 — 编辑器菜单栏的 **「在线」** 菜单对齐 GX Works2,是连着设备时做运维操作的地方。所有操作都要**先连接设备**(在主窗口选中设备再打开编辑器),未连接会提示「未连接设备,请先在设备列表中连接设备」。 — https://lpplc.cn/wiki/tool/06-01-online-diagnostics.html - 7.1 软 PLC 模拟器 — 没有实体设备也可以学习和调试程序。**软 PLC 模拟器**是一个运行在 Windows 上的独立程序,型号是 **LP6666**,与产品文档里的「LP6666 软 PLC」是同一个东西。它随上位机一起打包,点「🖥… — https://lpplc.cn/wiki/tool/07-01-simulator.html - 8.1 固件升级 — 设备固件在持续更新(修 bug、加功能),升级方式是在「固件升级」标签页里选一个 **`.LPPLC` 升级包**下发。 — https://lpplc.cn/wiki/tool/08-01-firmware-upgrade.html - 8.2 管理员模式与升级包制作 — ::: warning 这一章是给厂家和代理商用的 — https://lpplc.cn/wiki/tool/08-02-admin-upgrade-package.html - 9.1 菜单与快捷键参考 — 梯形图和 Lua 是两个独立窗口,菜单**不完全一样**:梯形图多出「在线」「监视」两个菜单,「文件」里多出 GX Works2 CSV 与 PDF 导出。 — https://lpplc.cn/wiki/tool/09-01-menus-shortcuts.html - 9.2 设置项参考 — 点主窗口顶部的 **⚙ 设置** 打开设置窗口。改完要点 **「保存」**(没改动时保存按钮是灰的),有未保存修改直接关窗口会弹确认。 — https://lpplc.cn/wiki/tool/09-02-settings-reference.html - 10.1 AI 编程助手 — 用自然语言描述需求,AI 帮您在编辑器里生成 **Lua / 梯形图 / DDC 程序 / DTU 配置**,并一键回填到工程——这是新版上位机工具里最值得一试的亮点功能。 — https://lpplc.cn/wiki/tool/10-01-ai-assistant.html - 10.2 本地模型(Ollama)部署与使用 — 想完全离线、代码数据不出本机、有显卡/内存想零成本复用本机算力——用 **Ollama** 把开源代码模型跑在本机,免费、隐私。 — https://lpplc.cn/wiki/tool/10-02-ai-local-model.html - 10.3 云端大模型(网络模型)使用 — 不想折腾环境、想要最强效果、愿意花几块钱——用 **DeepSeek** 云端 API,按 token 计费,代码能力强、巨便宜。 — https://lpplc.cn/wiki/tool/10-03-ai-cloud-model.html - 10.4 Lua 脚本编辑器里的 AI 使用 — 返回总览:10.1 AI 编程助手 | 模型怎么接:本地 10.2 / 云端 10.3 — https://lpplc.cn/wiki/tool/10-04-ai-lua-editor.html - 10.5 梯形图编辑器里的 AI 使用 — 返回总览:10.1 AI 编程助手 | 模型怎么接:本地 10.2 / 云端 10.3 — https://lpplc.cn/wiki/tool/10-05-ai-ladder-editor.html - 10.6 DDC 逻辑编程编辑器里的 AI 使用 — 返回总览:10.1 AI 编程助手 | 模型怎么接:本地 10.2 / 云端 10.3 — https://lpplc.cn/wiki/tool/10-06-ai-ddc-editor.html - 10.7 DTU 配置面板里的 AI 使用 — 返回总览:10.1 AI 编程助手 | 模型怎么接:本地 10.2 / 云端 10.3 — https://lpplc.cn/wiki/tool/10-07-ai-dtu-panel.html - 10.8 DDC 自定义块的 AI 使用 — 返回总览:10.1 AI 编程助手 | 模型怎么接:本地 10.2 / 云端 10.3 | 同编辑器:10.6 DDC 逻辑编程编辑器 — https://lpplc.cn/wiki/tool/10-08-ai-ddc-custom-block.html - 10.9 AI 客服与知识库 — 主窗口顶栏「✨ AI客服」打开的面板,标题是 **「AI 知识库」**。它不写程序,专门回答**功能类问题**:某个按钮在哪、某项参数填什么、报这条错是什么意思、这台设备支持不支持某个功能。 — https://lpplc.cn/wiki/tool/10-09-ai-support-kb.html - 10.10 用免费的大模型网页问(没装模型、也没有 API Key) — 电脑上什么都没装、也不想去注册充值拿 API Key —— 打开一个**免费的网页对话**照样能问 LPPLC 的问题、让它帮您写 Lua 和梯形图。这一页讲**怎么问才准**,以及拿回来的代码**怎么验证**。 — https://lpplc.cn/wiki/tool/10-10-ai-web-model.html - 11.1 命令行批量操作多台 PLC — 它适合:批量改名、批量写寄存器、批量下发 Lua 程序、批量更新 DTU 配置、批量重启等"对多台设备做同样的事"的场景。 — https://lpplc.cn/wiki/tool/11-01-cli-batch-plc.html - 11.2 批量写 Lua 程序(电气工程师专用) — 适用:给一批设备烧入相同的 Lua 逻辑(如初始化寄存器、定时翻转输出、采集上报等)。每台程序不同也行,把文件换成各自的即可。 — https://lpplc.cn/wiki/tool/11-02-batch-lua.html - 11.3 批量写 DTU 配置(电气工程师专用) — 适用:给一批设备写入相同的 DTU 通讯配置(如统一接入同一个 BACnet 网络或 MQTT 平台)。 — https://lpplc.cn/wiki/tool/11-03-batch-dtu.html - 11.4 批量写梯形图(电气工程师专用) — 适用:把同一份梯形图(指令表)刷到一批设备。文件就是一行条指令的纯文本,不是 CSV、也不是工程目录。 — https://lpplc.cn/wiki/tool/11-04-batch-ladder.html - 11.5 批量写 DDC 程序(电气工程师专用) — 适用:给一批设备写入相同的 DDC 控制逻辑。文件是一个 `ddc.json` 程序(由 DDC 编辑器"生成 JSON"得到,或手写)。 — https://lpplc.cn/wiki/tool/11-05-batch-ddc.html - 11.6 批量导出所有设备的程序(程序归档 / AI 分析) — 它适合: — https://lpplc.cn/wiki/tool/11-06-batch-export-programs.html - 11.7 用脚本批量读取设备程序(AI 与自动化) — 适合:批量备份程序、交给 AI 分析控制逻辑、定期归档现场设备的程序。 — https://lpplc.cn/wiki/tool/11-07-cli-for-ai.html - 11.8 上位机命令行参考(lpplc-manager.exe) — 本页是 **`lpplc-manager.exe` 命令行面**的静态镜像,方便**只在网页端(不装上位机)**的客户查看它能做什么。 — https://lpplc.cn/wiki/tool/11-08-cli-reference.html - 12.1 打开调试工具与串口调试 — **串口网口调试工具**是一个独立窗口,用来手工收发报文:选一个通道(串口 / TCP / UDP),把字节发出去,看对方回什么。装完程序第一次到现场、或者怀疑某台设备的串口参数不对时,这个窗口比写程序快得多。 — https://lpplc.cn/wiki/tool/12-01-debug-tool-serial.html - 12.2 TCP 与 UDP 调试 — 调试工具除了串口,还能当 **TCP 客户端、TCP 服务器、UDP 端点**用。现场最常用的两个场景:设备往您的电脑上报数据(本机当服务器听),或者本机模拟一台设备往服务器发(本机当客户端连过去)。 — https://lpplc.cn/wiki/tool/12-02-tcp-udp-debug.html - 12.3 报文校验、循环发送与自动回应 — 这一页讲**发**的那一半:报文怎么写、校验怎么自动补、怎么定时重发、怎么让这台电脑扮演一个会应答的从站。窗口怎么打开、记录区怎么看,见 12.1 打开调试工具与串口调试。 — https://lpplc.cn/wiki/tool/12-03-frame-check-loop-send.html - 附录 A. 老版配置工具(存档) — ::: warning 这一节讲的是老版上位机 — https://lpplc.cn/wiki/tool/a-01-legacy-config-tool.html - 上位机工具(LPPLC 上位机 v2.0) — LPPLC 上位机 v2.0 集设备搜索、参数配置、梯形图编程、Lua 脚本编程、在线监视、固件升级、软 PLC 模拟器于一体。 — https://lpplc.cn/wiki/tool/ --- 生成时间 2026-10-27;由 wiki 仓 `scripts/gen-ai-entry.mjs` 从 src 全量 .md 生成,请勿手改。 本文件只列客户可见内容;内部开发文档不在此站内。