Added license
This commit is contained in:
parent
d04a746160
commit
08c1cc989e
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Veles Labs s.r.o.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
32
modbus.c
32
modbus.c
@ -1,8 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
* modbus.c
|
* File: modbus.c
|
||||||
|
* Description: MODBUS RTU library
|
||||||
|
* Author: Jan Mrna
|
||||||
|
* Date: 2021-07-18
|
||||||
|
*
|
||||||
|
* Modbus slave RTU library (does NOT support ASCII and TCP)
|
||||||
|
*
|
||||||
|
* Note that byte order is big endian.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 Veles Labs s.r.o.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
*
|
*
|
||||||
* Created on: Jul 18, 2021
|
|
||||||
* Author: user
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modbus.h"
|
#include "modbus.h"
|
||||||
|
50
modbus.h
50
modbus.h
@ -1,37 +1,33 @@
|
|||||||
/*
|
/*
|
||||||
* modbus.h
|
* File: modbus.h
|
||||||
|
* Description: MODBUS RTU library
|
||||||
|
* Author: Jan Mrna
|
||||||
|
* Date: 2021-07-18
|
||||||
*
|
*
|
||||||
* Created on: Jul 18, 2021
|
* Modbus slave RTU library (does NOT support ASCII and TCP)
|
||||||
* Author: user
|
|
||||||
*
|
*
|
||||||
* Modbus slave RTU library (does NOT support ASCII and TCP)
|
* Note that byte order is big endian.
|
||||||
*
|
*
|
||||||
* Useful links:
|
|
||||||
* https://www.picotech.com/library/oscilloscopes/modbus-serial-protocol-decoding
|
|
||||||
* https://ipc2u.com/articles/knowledge-base/modbus-rtu-made-simple-with-detailed-descriptions-and-examples/
|
|
||||||
* https://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf
|
|
||||||
* https://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf
|
|
||||||
*
|
*
|
||||||
* Note that byte order is big endian.
|
* Copyright (c) 2024 Veles Labs s.r.o.
|
||||||
*
|
*
|
||||||
* USAGE:
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
*
|
*
|
||||||
* 1) Implement functions modbus_callback_function() and modbus_uart_transmit_function()
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
* - modbus_uart_transmit_function() sends data via UART
|
* copies or substantial portions of the Software.
|
||||||
* - modbus_callback_function() does the real work: read sensors, set outputs...
|
*
|
||||||
* note that when filling buffers (e.g. input_registers[]) user must
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* ensure that all data is big-endian
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* These functions are implementation-specific.
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* 2) Set device address (variable modbus_device_address); you can do this either
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* - setting modbus_device_address directly (modbus.h needs to be included, duh)
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* - using modbus_set_device_address(uint8_t address) function
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* Or you can leave address as-is (MODBUS_DEFAULT_SLAVE_ADDRESS) and set it via
|
* SOFTWARE.
|
||||||
* Modbus during runtime
|
|
||||||
* 3) Call modbus_process_msg() after message reception; you need to observe Modbus RTU timing:
|
|
||||||
* - pauses between chars in frame are less or equal to 1.5 char
|
|
||||||
* - pauses between frames are at least 3.5 chars (of silence)
|
|
||||||
* For more information see section 2.5.1.1 (MODBUS Message RTU Framing)
|
|
||||||
* in "MODBUS over Serial Line: Specification and Implementation Guide"
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user