Challenge - 5 Problems
Modbus RTU Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediateWhat is the output of this Modbus RTU frame parsing?
Given the following Modbus RTU frame bytes received:
What is the value of the register read?
01 03 02 00 0A C4 0BWhat is the value of the register read?
PLC Programming
frame = bytes([0x01, 0x03, 0x02, 0x00, 0x0A, 0xC4, 0x0B]) # Extract data bytes register_value = frame[3] << 8 | frame[4] print(register_value)
Attempts:
2 left
💡 Hint
Look at the data bytes in the frame and combine them as a 16-bit number.
✗ Incorrect
The data bytes are 0x00 and 0x0A. Combining them as (0x00 << 8) + 0x0A equals 10 decimal.
📝 Syntax
intermediateWhich Modbus RTU request frame is correctly formed to read 3 registers starting at address 0x006B?
Select the correct Modbus RTU request frame bytes for reading 3 registers starting at 0x006B from slave address 0x11.
Attempts:
2 left
💡 Hint
Function code 03 is for reading holding registers. Address and quantity are 2 bytes each in big-endian.
✗ Incorrect
Option D correctly uses function code 03, address 0x006B (00 6B), quantity 3 (00 03), followed by CRC bytes.
🔧 Debug
advancedWhy does this Modbus RTU communication script fail to read registers?
This Python snippet tries to read holding registers but returns no data:
What is the most likely cause?
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600, parity=serial.PARITY_NONE, stopbits=1)
request = bytes([0x01, 0x03, 0x00, 0x00, 0x00, 0x02, 0xC5, 0xC8])
ser.write(request)
response = ser.read(7)
print(response)What is the most likely cause?
Attempts:
2 left
💡 Hint
Check if the CRC matches the rest of the frame bytes.
✗ Incorrect
If CRC is wrong, the slave device ignores the request and no response is sent.
🚀 Application
advancedHow to automate periodic Modbus RTU register reads in a script?
You want to read holding registers every 5 seconds from a Modbus RTU slave device using a script. Which approach is best?
Attempts:
2 left
💡 Hint
Think about how to space out requests and handle communication errors.
✗ Incorrect
A loop with sleep and error handling ensures regular polling and robustness.
🧠 Conceptual
expertWhat is the main reason Modbus RTU uses CRC instead of checksum?
Why does Modbus RTU protocol use a 16-bit CRC for error checking instead of a simpler checksum?
Attempts:
2 left
💡 Hint
Think about error detection capabilities on noisy communication lines.
✗ Incorrect
CRC can detect multiple bit errors and burst errors better than simple checksums, which is critical for serial communication reliability.
