Modbus serial library.
More...
#include <stdint.h>
Go to the source code of this file.
Modbus serial library.
Definition in file modbus.h.
◆ modbus_analyse_and_answer()
uint8_t modbus_analyse_and_answer |
( |
void |
| ) |
|
Analyses the received frame and answer to server
- Returns
- an error code if frame not valid
Definition at line 40 of file modbus.c.
◆ modbus_char_recvd()
void modbus_char_recvd |
( |
void |
| ) |
|
This function will be called every time a character has been received on the Modbus serial port. It is called from the interrupt hander.
- Parameters
-
c | : the received char // removed ! |
- See also
- interrupts.c.
Definition at line 85 of file modbus.c.
◆ modbus_init()
void modbus_init |
( |
uint8_t |
address | ) |
|
Initializes this Modbus library.
Initialize pins, timer, serial port and variables. Interrupts MUST be initialized for the timer and the serial port.
- Parameters
-
address | : the Modbus address of this device |
- See also
- modbus_char_recvd
-
modbus_timer
-
interrupts.c
Definition at line 108 of file modbus.c.
◆ modbus_send()
void modbus_send |
( |
uint8_t |
length | ) |
|
Send the Modbus frame on tx_buf with CRC added
- Parameters
-
length | : length of the frame without the CRC |
Definition at line 92 of file modbus.c.
◆ modbus_timer()
void modbus_timer |
( |
void |
| ) |
|
Modbus timer finished. This function is called by the interrupt handler when a MODBUS frame is finished. It must analyse the received packet and reply if required.
- See also
- interrupts.c
Definition at line 33 of file modbus.c.
◆ holding_registers
uint16_t holding_registers[2] |
|
extern |
◆ input_registers
uint16_t input_registers[2] |
|
extern |
◆ modbusAddress