Modbus Slave
The Modbus Slave feature enables your device to act as a Modbus slave (server), allowing other Modbus masters to read your device's data and control its functions. This is essential for integrating your device into existing industrial automation systems.
Overview
As a Modbus slave, your device can:
- Expose sensor data to SCADA systems
- Accept control commands from PLCs
- Integrate with industrial monitoring systems
- Provide standard Modbus interface to custom hardware
- Enable remote device control and monitoring
Supported Protocols
AppBlocks supports both Modbus slave variants:
Modbus RTU Slave
- Serial communication (RS-485, RS-232)
- Binary protocol for efficiency
- Multi-drop bus topology
- Unique slave address (1-247)
Modbus TCP Slave
- Ethernet-based communication
- Port 502 (standard Modbus TCP port)
- Multiple simultaneous master connections
- Higher bandwidth and speed
Configuration
Configure Modbus Slave with these properties:
For Modbus RTU:
- Slave Address: Device address on Modbus bus (1-247)
- Serial Port: COM port for communication
- Baud Rate: Communication speed (9600, 19200, 38400, etc.)
- Parity: None, Even, or Odd
- Stop Bits: 1 or 2
- Data Bits: 7 or 8
For Modbus TCP:
- Port: TCP port to listen on (default: 502)
- Maximum Connections: Concurrent master limit
Register Mapping
Map your application variables to Modbus registers:
Register Types:
- Coils (0x): Digital outputs (read/write)
- Discrete Inputs (1x): Digital inputs (read-only)
- Input Registers (3x): Analog inputs (read-only)
- Holding Registers (4x): Analog data (read/write)
Address Ranges:
- Addresses 0-65535 available
- Map to AppBlocks variables
Related Blocks
Use these blocks for Modbus slave functionality:
- Modbus Slave Register: Define register mappings
- On Variable Changed: Triggered when master writes to registers
- Variable Set: Set the value of a register
Register Definition
Define Modbus registers for your application:
- Choose register type (coil, discrete input, input register, holding register)
- Assign register address
- Register is automatically linked to a variable
- Configure data format (int16, uint16, float, etc.)
Automatic Variable Sync
Register values automatically synchronize with linked variables:
- Master reads get current variable value
- Master writes update variable value
- Variable changes update register values
- Bidirectional data flow
Function Code Support
Modbus slave responds to:
- FC01: Read Coils
- FC02: Read Discrete Inputs
- FC03: Read Holding Registers
- FC04: Read Input Registers
- FC05: Write Single Coil
- FC06: Write Single Register
- FC15: Write Multiple Coils
- FC16: Write Multiple Registers
Exception Handling
The slave automatically handles:
- Invalid function codes
- Invalid register addresses
- Invalid data values
- Communication errors
Masters receive appropriate Modbus exception codes.
Security Considerations
Modbus protocol has limited built-in security:
- Use Modbus TCP with VPN for secure remote access
- Implement firewall rules to restrict access
- Use Modbus RTU on isolated networks
- Consider additional authentication layers
Performance
Optimize slave performance:
- Minimize register mapping overhead
- Use continuous register blocks when possible
- Avoid complex calculations in read handlers
- Batch variable updates
Linking to Settings
Modbus slave properties can be linked to settings for:
- Runtime slave address configuration
- Dynamic register mapping
- Field-configurable communication parameters
Use Cases
Common Modbus slave applications:
- Exposing sensor data to SCADA systems
- Integrating custom devices with PLCs
- Building management system integration
- Industrial data acquisition
- Remote monitoring endpoints
Integration Examples
Connect your AppBlocks device to:
- Allen-Bradley PLCs
- Siemens S7 controllers
- Schneider Electric systems
- LabVIEW applications
- Third-party SCADA platforms
Related Features
- Modbus Master: Read from other Modbus devices
- Variables: Data storage and access
- Network: Network configuration for Modbus TCP
Troubleshooting
Common Modbus slave issues:
- No response: Check slave address and communication settings
- CRC errors: Verify baud rate and parity settings
- Invalid data: Check register mapping and data types
- Timeout: Verify network connectivity and firewall rules