Note
This Bricklet is currently in the prototype stage and the software/hardware as well as the documentation is in an incomplete state.
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 SetConfigurations() 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_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.
Function ID: | 7 |
---|---|
Request: | empty payload |
Response: |
|
Returns the configuration as set by set_configuration.
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_callback.