This is the description of the Modbus protocol for the RS232 Bricklet. General information and technical specifications for the RS232 Bricklet are summarized in its hardware description.
A general description of the Modbus protocol structure can be found here.
Function ID: | 1 |
---|---|
Request: |
|
Response: |
|
Writes a string of up to 60 characters to the RS232 interface. The string can be binary data, ASCII or similar is not necessary.
The length of the string has to be given as an additional parameter.
The return value is the number of bytes that could be written.
See set_configuration for configuration possibilities regarding baudrate, parity and so on.
Function ID: | 2 |
---|---|
Request: | empty payload |
Response: |
|
Returns the currently buffered message. The maximum length of message is 60. If the length is given as 0, there was no new data available.
Instead of polling with this function, you can also use callbacks. See enable_read_callback and CALLBACK_READ callback.
Function ID: | 6 |
---|---|
Request: |
|
Response: | no response |
Sets the configuration for the RS232 communication. Available options:
The default is: 115200 baud, parity none, 1 stop bit, word length 8, hard-/software flow control off.
The following meanings are defined for the parameters of this function:
Function ID: | 7 |
---|---|
Request: | empty payload |
Response: |
|
Returns the configuration as set by set_configuration.
The following meanings are defined for the parameters of this function:
Function ID: | 10 |
---|---|
Request: |
|
Response: | no response |
Sets a break condition (the TX output is forced to a logic 0 state). The parameter sets the hold-time of the break condition (in ms).
New in version 2.0.2 (Plugin).
Function ID: | 255 |
---|---|
Request: | empty payload |
Response: |
|
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.
The position can be 'a', 'b', 'c' or 'd'.
The device identifier numbers can be found here.
Function ID: | 3 |
---|---|
Request: | empty payload |
Response: | no response |
Enables the CALLBACK_READ callback.
By default the callback is disabled.
Function ID: | 4 |
---|---|
Request: | empty payload |
Response: | no response |
Disables the CALLBACK_READ callback.
By default the callback is disabled.
Function ID: | 5 |
---|---|
Request: | empty payload |
Response: |
|
Returns true if the CALLBACK_READ callback is enabled, false otherwise.
Function ID: | 8 |
---|---|
Response: |
|
This callback is called if new data is available. The message has a maximum size of 60 characters. The actual length of the message is given in addition.
To enable this callback, use enable_read_callback.
Function ID: | 9 |
---|---|
Response: |
|
This callback is called if an error occurs. Possible errors are overrun, parity or framing error.
New in version 2.0.1 (Plugin).
The following meanings are defined for the parameters of this function: