OpenPLC Introduction
This topic provides an overview of OpenPLC, its architecture, I/O capabilities, and communication protocols.
What Is OpenPLC
OpenPLC is an open-source implementation of a programmable logic controller (PLC) that follows the IEC 61131-3 standard. It provides a complete runtime environment for executing PLC programs on various hardware platforms, including single-board computers such as VisionFive 2 and VisionFive 2 Lite.
The following table describes the OpenPLC components:
| Component | Description |
|---|---|
| OpenPLC Editor | An IEC 61131-3 compliant development environment for creating PLC programs |
| OpenPLC Runtime | The core execution engine that executes compiled programs on target hardware, managing I/O operations, communication protocols, and real-time control functions. |
| Hardware Layer | Platform-specific code that interfaces with physical I/O devices |
I/O Capabilities and Pin Mapping References
OpenPLC on VisionFive 2 provides the following I/O capabilities:
| I/O Type | Quantity | Address Range |
|---|---|---|
| Digital Input | 8 | %IX0.0 to %IX0.7 |
| Digital Output | 8 | %QX0.0 to %QX0.7 |
| Analog Output | 1 | %QW0 |
The following provides complete pin mapping information for the 40-pin GPIO header on
VisionFive 2.
| OpenPLC I/O | Pin Name | Pin # | Pin # | Pin Name | OpenPLC I/O |
|---|---|---|---|---|---|
| 3v3 Power | 3v3 Power | 1 | 2 | 5V Power | 5v Power |
| N/A | GPIO 58 (I2C SDA) | 3 | 4 | 5V Power | 5v Power |
| N/A | GPIO 57 (I2C SCL) | 5 | 6 | Ground | Ground |
| %IX0.0 | GPIO 55 (GPCLK0) | 7 | 8 | GPIO 5 (UART TX) | N/A |
| Ground | Ground | 9 | 10 | GPIO 6 (UART RX) | N/A |
| %IX0.1 | GPIO 42 | 11 | 12 | GPIO 38 (PCM CLK) | %QW0 |
| %IX0.2 | GPIO 43 | 13 | 14 | Ground | Ground |
| %IX0.3 | GPIO 47 | 15 | 16 | GPIO 54 | %QX0.0 |
| 3v3 Power | 3v3 Power | 17 | 18 | GPIO 51 | %QX0.1 |
| N/A | GPIO 52 (SPI MOSI) | 19 | 20 | Ground | Ground |
| N/A | GPIO 53 (SPI MISO) | 21 | 22 | GPIO 50 | %QX0.2 |
| N/A | GPIO 48 (SPI SCLK) | 23 | 24 | GPIO 49 (SPI0 CE0) | N/A |
| Ground | Ground | 25 | 26 | GPIO 56 | %QX0.3 |
| N/A | GPIO 45 | 27 | 28 | GPIO 40 | %QX0.4 |
| %IX0.4 | GPIO 37 | 29 | 30 | Ground | Ground |
| %IX0.5 | GPIO 39 | 31 | 32 | GPIO 46 (PWM0) | N/A |
| N/A | GPIO 59 (PWM1) | 33 | 34 | Ground | Ground |
| %IX0.6 | GPIO 63 | 35 | 36 | GPIO 36 | %QX0.5 |
| %IX0.7 | GPIO 60 | 37 | 38 | GPIO 61 | %QX0.6 |
| Ground | Ground | 39 | 40 | GPIO 44 | %QX0.7 |
Communication Protocols
OpenPLC supports multiple industrial communication protocols:
| Protocol | Type | Application |
|---|---|---|
| Modbus RTU | Serial | Modbus-RTU master device communication |
| Modbus TCP | Ethernet | Modbus-TCP master/slave; SCADA connectivity |
| DNP3 | Ethernet | SCADA integration |
| Ethernet/IP | Ethernet | SCADA integration |