-

How to communicate to iC9200 using RSC (PyPLCnextRsc) from a Python application on a PC

Version NumberDescription
1.0 Initial version
2.0 Added restriction that only Python version 3.7.6 can be used.


This application note shows how to write a script in Python on a user's PC and use the PyPLCnextRSC to communicate and exchange data with the iC9200 controller.

1. Supported Components

Component NameVersion
iC9200 series ≥ 2024.3
iCube Engineer ≥ 2024.3
Python = 3.7.6

2. Solution details

Create a new Python Script and Install the "PyPlcnextRsc" library using the following pip command.  Python version 3.7.6  is required for this solution.  

Image


Add the following modules to the Python Script 

Image


To establish communication with the iC9200 controller use the 'Device' class from PyPlcnextRsc as shown below. Define the ipAddress, user name and password as required. 


Image

Launch iCube engineer and create a template project for iC9200 controller. Create a user-defined datatype as shown below.  


Image

Create a POU named 'Main.' Open the POU's variable worksheet add the following port variable with the same datatype created earlier.


Image

In Main POU's code worksheet add a simple logic to move the value of "Trajectory_0" to "Trajectory_1"  


Image

Create a new cyclic task of interval 4ms and assign the Main POU to the task. Rebuild and download the program to the controller.  


Image



In Python Script, create an object called 'data_access_service' to access data from the iC9200 controller.  


Image

Create a new data type instance by copying and pasting the data structure from iCube Engineer into the Python script as shown below. This method offers a convenient way to construct complex user-defined data structures from IEC61131 to Python. 


Image

Create a new instance of the PathStruct data and assign some values to the structure. Use the data_access_service object to write these values to the "Arp.Plc.Eclr/Main.Trajectory_0" port variable, as shown below. To receive and print the response, use the "Arp.Plc.Eclr/Main.Trajectory_1" port variable.


Image

 


This help information is valid for iCube Engineer Online Help 2025.6

Copyright © 2025 YASKAWA EUROPE GmbH and © 2025 YASKAWA America, Inc.