Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 766df48

Browse files
authored
Initial commit - Extended Ethernet.begin() & minor update to tutorial content (#1347)
1 parent 7664a3b commit 766df48

File tree

1 file changed

+7
-5
lines changed
  • content/hardware/07.opta/opta-family/opta/tutorials/opta-modbus-tcp-plc-ide

1 file changed

+7
-5
lines changed

‎content/hardware/07.opta/opta-family/opta/tutorials/opta-modbus-tcp-plc-ide/content.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@ We highly recommend reviewing [this tutorial](https://docs.arduino.cc/tutorials/
140140

141141
To configure the Modbus TCP communication, we need to know the IP address of each OptaTM. When OptaTM is connected to a computer using the RJ-45 cable and the Ethernet switch, and the ethernet configuration is left as default, an IP address is automatically provided to OptaTM by the external *Dynamic Host Configuration Protocol (DHCP)* server. You will need to scan for the address and use that IP address as the device address of OptaTM. To find the automatically assigned IP address, it is possible to use this [scanner](https://angryip.org/) to identify the address.
142142

143-
OptaTM can also be configured manually with a specific IP address. This method is viable to assign devices with specific addresses to operate under certain policies if required. For this configuration, the IP setting must be defined by using the sketch found within the `Resources` tab of the PLC IDE. The following image shows what the configuration could look like inside the sketch.
143+
OptaTM can also be configured manually with a specific IP address using __Ethernet.begin()__ method. This method is viable to assign devices with specific addresses to operate under certain policies if required. For this configuration, the IP setting must be defined by using the sketch found within the `Resources` tab of the PLC IDE. The following image shows what the configuration could look like inside the sketch.
144144

145145
![OptaTM Manual IP Configuration](assets/opta_plcide_ipconfig.png)
146146

147+
***The __Ethernet.begin(ip, dns, gateway, subnet)__ method postpones initialization for 60 seconds when the RJ45 cable is found to be disconnected or when Ethernet settings, such as the IP address, are improperly configured. The __Ethernet.begin(NULL, ip, dns, gateway, subnet, connection_timeout)__ method can be used to extend initialization process and tweak the `connection_timeout` value. This parameter sets the timeout period for the Data Layer connection to be established.***
148+
147149
If the IP address for OptaTM is set manually, it is necessary to configure the Ethernet interface on your computer by introducing a manual IP address setting under *IPv4*. The information set under the IPv4 configuration follows the gateway setting. A stable connection with OptaTM using the PLC IDE is essential for project development. The following image shows a configuration example on Windows 11 operating system:
148150

149151
![Windows IP Manual IP Configuration](assets/plcide_ip_manual_config.png)
@@ -207,9 +209,11 @@ In the sections that follow, the configuration of each OptaTM, based on its des
207209
#### Modbus TCP Server OptaTM
208210
<br></br>
209211

210-
To set OptaTM as a Modbus TCP Server, navigate to the `Ethernet` tab located in the `Resources` panel of the PLC IDE. Since the `Modbus TCP Slave` mode is always enabled, you don't have to change any setting in the current window. However, certain properties are essential for OptaTM to work properly with Modbus TCP, thus it requires the subsequent configuration.
212+
To set OptaTM as a Modbus TCP Server, navigate to the `Ethernet` tab located in the `Resources` panel of the PLC IDE. Since the `Modbus TCP Slave` mode is always enabled, you don't have to change any setting in the current window. Ethernet properties are essential for OptaTM to work properly with Modbus TCP, thus it requires a proper Ethernet configuration.
213+
214+
When initializing a project file in PLC IDE, Ethernet properties within the sketch are commented out. These lines should be uncommented to activate the configurations. Once this is done, the sketch should be manually downloaded to OptaTM through the `OptaTM Configuration` window.
211215

212-
The Modbus TCP Server OptaTM will employ the following Ethernet properties.
216+
The Modbus TCP Server OptaTM will employ the following Ethernet properties within the sketch.
213217

214218
```arduino
215219
@@ -227,8 +231,6 @@ void setup()
227231

228232
These properties — `ip`, `dns`, `gateway`, and `subnet` — are provided as arguments to the `Ethernet.begin()` method, setting its properties for OptaTM. It can be adjusted as per your preference or based on network prerequisites. For instance, `ip(192, 168, 1, 2)` denotes the IP address assigned to the Modbus TCP Server OptaTM.
229233

230-
When initializing a project file in PLC IDE, certain essential lines within the sketch are commented out. These lines should be uncommented to activate the configurations. Once this is done, the sketch should be manually downloaded to OptaTM through the `OptaTM Configuration` window.
231-
232234
The following image shows the `Status variables (volatile)` window. Here, we will define the `cnt` variable, assigning its access address and datatype for Modbus TCP transmission.
233235

234236
![Arduino PLC IDE - OptaTM Server Status Variable](assets/opta_plcide_server_statVar.svg)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /