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

  1. Open HMI_First_Test.mp2, which has completed its first build and upload, and save it as HMI_Cnet_Test.mp2 under File → Save As.
  2. Open Run → Communication and change the protocol of Serial1 to LS Electric Cnet Slave.
  3. Check Slave ID 1, Baud Rate 9600, Data Bits 8, Stop Bits 1, and Parity None, then press Ctrl+S to 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.

Initial screen showing where each item is. The protocol None and 115200 in the figure are only an example; this exercise changes them to LS Electric Cnet Slave and 9600.

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.

Ladder that copies internal M0 to M1 without any real output

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

  1. Run Run → Build (Ctrl+R) and check that there are no errors.
  2. 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.
  3. In Building the HMI Screen, select the Cnet driver, assign D000~D002 and M000 and M001 from the table above, then save and transfer with station 1 and 9600/8N1. Use Serial1 on the product only for HMI communication.
  4. After connecting the hardware, check in this order in Checking Operation and Troubleshooting: read D000 → write D001 and read D002 → bits M000/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 →