H5.modbus
Implementation of the MODBUS IP/ASCII/RTU master and slave over TCP/UDP/Serial for Node.js.
Install / Use
/learn @morkai/H5.modbusREADME
h5.modbus
Implementation of the MODBUS IP/ASCII/RTU master and slave over TCP/UDP/Serial/WebSocket for Node.js.
TODO
- Remaining messages
- Tests
- Documentation
- npm publish
Requirements
- Node.js >= v8
- voodootikigod/node-serialport >= v6 (only for serial port communication).
- websockets/ws >= v1 (only for WebSocket communication).
Installation
npm install github:morkai/h5.modbus#master
Usage
'use strict';
const modbus = require('h5.modbus');
const slave = modbus.createSlave({requestHandler: handleRequest});
const master = modbus.createMaster();
master.once('open', () => master.readHoldingRegisters(0x0000, 10, handleResponse));
function handleRequest(unit, request, respond)
{
respond(modbus.ExceptionCode.IllegalFunctionCode);
}
function handleResponse(err, res)
{
if (err)
{
console.error(`[master#error] ${err.message}`);
}
else if (res.isException())
{
console.log(`[master#exception] ${res}`);
}
else
{
console.log(`[master#response] ${res}`);
}
}
License
This project is released under the MIT License.
Related Skills
node-connect
354.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
