{"id":20314301,"url":"https://github.com/normandy72/modbus-rtu-for-unity","last_synced_at":"2026-05-15T22:05:59.062Z","repository":{"id":243557842,"uuid":"812737555","full_name":"Normandy72/Modbus-Rtu-For-Unity","owner":"Normandy72","description":"Modbus RTU protocol for Unity.","archived":false,"fork":false,"pushed_at":"2024-06-09T20:01:33.000Z","size":1301,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-14T12:46:14.584Z","etag":null,"topics":["android","modbus","modbusrtu","odroid","unity"],"latest_commit_sha":null,"homepage":"","language":"ShaderLab","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Normandy72.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-09T18:28:31.000Z","updated_at":"2024-06-09T20:01:36.000Z","dependencies_parsed_at":"2024-06-09T21:09:56.768Z","dependency_job_id":"2fd17551-b8a9-4859-afd5-a93440e6f0a2","html_url":"https://github.com/Normandy72/Modbus-Rtu-For-Unity","commit_stats":null,"previous_names":["normandy72/modbus-rtu-for-unity"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModbus-Rtu-For-Unity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModbus-Rtu-For-Unity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModbus-Rtu-For-Unity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModbus-Rtu-For-Unity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Normandy72","download_url":"https://codeload.github.com/Normandy72/Modbus-Rtu-For-Unity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241818842,"owners_count":20025208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","modbus","modbusrtu","odroid","unity"],"created_at":"2024-11-14T18:14:41.538Z","updated_at":"2025-10-25T05:03:50.910Z","avatar_url":"https://github.com/Normandy72.png","language":"ShaderLab","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MODBUS RTU for UNITY\n\nModbusRTU is a library for working with the Modbus RTU protocol in C#. The library provides simple methods for reading and writing registers, coils, and other Modbus RTU elements via a serial port.\n\n### INSTALLATION\nYou can copy the source code from the ModbusRTU.cs file directly into your project, or add the ModbusRTU.cs file as a reference to your project.\n\n### USAGE\nATTENTION! It works only with .NET Framework (Project Settings -\u003e Player -\u003e Other Settings -\u003e Api Compatibility Level -\u003e .NET Framework).\n\n1. Create an instance of the ModbusRTU class, specifying the serial port name and baud rate.\n2. Call the `Connect()` method to establish a connection with the device.\n3. Perform the necessary read or write operations on registers, coils, etc., using the appropriate methods of the ModbusRTU class.\n4. After completing work with the device, call the `Disconnect()` method to close the connection.\n\n```\nusing UnityEngine;\nusing System;\n\npublic class Example : MonoBehaviour\n{\n    private ModbusRTU _modbus;\n\n    void Start()\n    {\n        _modbus = new ModbusRTU(\"COM1\", 9600);\n\n        if(_modbus.Connect())\n        {\n            // DO SOMETHING IF CONNECTED\n        }\n        else\n        {\n            // DO SOMETHING IF CONNECTION FAILED\n        }\n    }\n}\n```\n\n### METHODS\n#### Connect()\nEstablishes a connection with the device. Returns true if the connection is established successfully, and false otherwise.\n\n#### Disconnect()\nCloses the connection with the device.\n\n### Reading and writing registers\n#### ReadSingleRegister(byte deviceId, ushort startAddress)\nReads the value of a single register.\n\n#### ReadSingleRegisterAsync(byte deviceId, ushort startAddress)\nAsynchronously reads the value of a single register.\n\n#### WriteSingleRegister(byte deviceId, ushort registerAddress, ushort value)\nWrites a value to a single register.\n\n#### WriteSingleRegisterAsync(byte deviceId, ushort registerAddress, ushort value)\nAsynchronously writes a value to a single register.\n\n#### WriteMultipleRegisters(byte deviceId, ushort startAddress, ushort[] values)\nWrites values to multiple consecutive registers.\n\n#### WriteMultipleRegistersAsync(byte deviceId, ushort startAddress, ushort[] values)\nAsynchronously writes values to multiple consecutive registers.\n\n### Reading and writing coils\n#### ReadCoils(byte deviceId, ushort startAddress, ushort coilCount)\nReads the values of coils.\n\n#### ReadCoilsAsync(byte deviceId, ushort startAddress, ushort coilCount)\nAsynchronously reads the values of coils.\n\n#### WriteSingleCoil(byte deviceId, ushort coilAddress, bool value)\nWrites a value to a single coil.\n\n#### WriteSingleCoilAsync(byte deviceId, ushort coilAddress, bool value)\nAsynchronously writes a value to a single coil.\n\n#### WriteMultipleCoils(byte deviceId, ushort startAddress, bool[] values)\nWrites values to multiple coils.\n\n#### WriteMultipleCoilsAsync(byte deviceId, ushort startAddress, bool[] values)\nAsynchronously writes values to multiple coils.\n\n### Other functions\n#### ReadExceptionStatus(byte deviceId)\nReads the exception status (only for Modbus RTU).\n\n#### ReadExceptionStatusAsync(byte deviceId)\nAsynchronously reads the exception status (only for Modbus RTU).\n\n#### DiagnosticsEcho(byte deviceId, byte[] data)\nPerforms a diagnostic echo request.\n\n#### DiagnosticsEchoAsync(byte deviceId, byte[] data)\nAsynchronously performs a diagnostic echo request.\n\n#\n### License\nThis library is distributed under the MIT license. See the LICENSE file for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnormandy72%2Fmodbus-rtu-for-unity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnormandy72%2Fmodbus-rtu-for-unity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnormandy72%2Fmodbus-rtu-for-unity/lists"}