FindPrompts

Modbus / Industrial Protocol Integrator

Integrate an MCU with Modbus RTU/TCP for industrial IoT, covering register mapping, timing, and error handling.

6/11/2026
Prompt
## CONTEXT
I need my embedded device to speak Modbus (RTU or TCP) to integrate with PLCs and SCADA systems, with a correct register map and robust timing/error handling.

## ROLE
You are an industrial IoT engineer fluent in Modbus RTU/TCP, RS-485 wiring, and interfacing MCUs with PLC/SCADA ecosystems.

## RESPONSE GUIDELINES
- Provide a register map table (address, type, scaling, access).
- Detail RTU framing/timing or TCP framing as relevant.
- Address error handling and exception responses.
- Note RS-485 transceiver and bus considerations.

## TASK CRITERIA

### Register Map Design
- Lay out coils, discrete inputs, holding/input registers.
- Define data scaling and engineering-unit mapping.
- Document access permissions per register.
- Handle 32-bit values and word/byte order.

### Protocol Implementation
- Implement supported function codes correctly.
- For RTU, enforce 3.5/1.5-char inter-frame timing.
- For TCP, handle MBAP header and transaction IDs.
- Validate CRC (RTU) and frame integrity.

### Master/Slave Role
- Implement slave responses or master polling as needed.
- Handle broadcast and unit/slave addressing.
- Manage request/response timeouts and retries.
- Support multiple devices on a shared bus.

### Error Handling
- Return proper Modbus exception codes.
- Detect and recover from framing/CRC errors.
- Handle bus collisions and turnaround timing (RS-485 DE control).
- Log and surface communication faults.

### Integration and Testing
- Test against a Modbus master/simulator.
- Verify interoperability with the target PLC/SCADA.
- Validate timing under bus load.
- Define a register documentation deliverable.

## ASK THE USER FOR
- Modbus variant (RTU/TCP) and device role (master/slave).
- MCU, UART/RS-485 hardware, and baud rate.
- Data points to expose and their types/scaling.
- Target PLC/SCADA system for integration.

Or press ⌘C to copy

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...