Table of Contents
MPINO STUDIO2 · Connecting an HMI with LS Electric Cnet
← Modbus RTU exercise · STUDIO2 start
In STUDIO2's LS Electric Cnet Slave, %DW0 in a Cnet request corresponds to internal D0, and %MX00000 corresponds to internal M0. In LS Electric, M2I, and EasyView HMI editors, select the Cnet driver and enter M and D memory names such as D000 and M000. Modbus Coil 1000 and Holding Register 2000 are not Cnet addresses.
Start this conversion example after you have created the project, set the memory, built the ladder, entered the main code, and finished the first build and upload in the STUDIO2 Modbus RTU example. You do not need to build the Modbus HMI screen or test real communication first. The Arduino IDE Cnet example does not have this prerequisite.
1. Change the communication protocol
- Open
HMI_First_Test.mp2, which has completed its first build and upload, and save it asHMI_Cnet_Test.mp2under File → Save As. - Open Run → Communication and change the protocol of
Serial1to LS Electric Cnet Slave. - Check Slave ID
1, Baud Rate9600, Data Bits8, Stop Bits1, and ParityNone, then pressCtrl+Sto save.
The figure below is an initial screen that shows where each item is. Its protocol None and baud rate 115200 are not the values for this exercise. Set and save LS Electric Cnet Slave and 9600 as described above.
On the HMI side, check the Cnet driver and connection port in Choose a protocol.
2. Check the internal ladder and code
Settings → Memory Area Settings remains P 64 and M, D, C, T, and R 16 each, and Use for all physical pins remains cleared in Ladder Pin Map Settings. Ladder → ladderLoop is the single rung NO contact M0 → output coil M1.
Keep the main code the same as the complete code in the Modbus exercise. STUDIO2 generates the communication functions, so do not add ICnetMem(), ICnetInit(), or ICnet() yourself.
Internal D0 increments every second, and a value the HMI writes to D001 is copied from internal D1 to D2. When the HMI changes M000, you can see the ladder result M1 at the HMI's M001. D is a signed 16-bit integer.
3. Cnet HMI addresses
| HMI element | STUDIO2 internal memory | HMI entry example | Operation |
|---|---|---|---|
| Number that changes every second | D0 | D000 | Read |
| Number input | D1 | D001 | Read and write |
| Number that returns the input value | D2 | D002 | Read |
| Switch and check lamp | M0 | M000 | Write and read |
| Lamp for the ladder result | M1 | M001 | Read |
The HMI entry examples apply to LS Electric, M2I, and EasyView HMIs. For other HMIs, check the address format of the selected Cnet driver. Modbus Coil 1000 and Holding Register 2000 are not Cnet addresses.
Set the three numbers to 16-bit integer, 1 word, 0 decimal places, scale 1, and limit the input range to 0~9999. Set the switch to write M000 as a toggle, and read it back with a separate lamp. This program does not control any physical output.
4. Rebuild and check
- Run Run → Build (
Ctrl+R) and check that there are no errors. - Select the PC COM port of your product's download cable in the status bar, then run Run → Upload (
Ctrl+U). Confirm that the upload log in the bottom panel ends normally. For the port and log locations, see Select a Port and Upload. - In Building the HMI Screen, select the Cnet driver, assign
D000~D002andM000andM001from the table above, then save and transfer with station1and9600/8N1. UseSerial1on the product only for HMI communication. - After connecting the hardware, check in this order in Checking Operation and Troubleshooting: read
D000→ writeD001and readD002→ bitsM000/M001.
This example was checked up to code generation and compilation with the SDK installed by STUDIO2. The behavior of a specific HMI driver and cable must be verified separately.
Building the HMI Screen → · Checking Operation and Troubleshooting →
