-

How to send files to and receive files from the iC922x Controller using RSCs and Python code on a PC

Version Number Description
1.0 The initial version, detailing the process of sending or receiving files from the controller user data folder via RSC connection, is demonstrated through an illustrative example in Python script.


This application note will explain the process of sending and receiving files from the user data folder (/opt/plcnext/user/data) of iC922X controllers by establishing an RSC (Remote Service Call) connection. An example Python script will illustrate the usage of RSC services to read and write files to the controller. The same method can be applied to applications developed in other programming languages like C# or C++.

1. Supported Components

Component Name Version
iC9200 series ≥ 202x.x
iCube Engineer ≥ 202x.x

2. Solution details

2.1 RSC Installation

 To use the RSC service in a Python script, start by installing the PyPlcnextRsc service package by entering the following command in the terminal. Python version 3.7.6 or higher is required for this installation.  After the installation, import the supporting modules and objects.

Image

Image

Additionally, there are SDKs available for implementing the RSC service in C#. For access to the APIs and documentation, please refer to the provided link.

https://plcnext.help/te/Communication_interfaces/Remote_Service_Calls_RSC/RSC_documentation_reference.htm

However, this application note will only focus on demonstrating the usage of RSC services in Python script.

2.2 Connection

In order to transmit the files, first a connection need to be established with the PLC using the 'Device' class from PyPlcnextRsc as shown below. Define the ipAddress, user name and password as required. Use port 41100 as shown in the example below.

Image

Note: In case of timeout error as follow:
Image

Increase the time out as follow :
Image

2.3 Send files

Files can be sent to the PLC using the 'IFileService' class from PyPlcnextRsc. Here's an example code snipet that will send a file called 'Test.csv' from a local directory to the controllers user data folder (/opt/plcnext/user/data).

Image

2.4 Receive files

Similary a file can also be read from the controller's user data folder (/opt/plcnext/user/data) using the 'IFileService'. The following code snippet demonstrates reading a file from the controller and storing it in the local directory as defined by the user.

Image

 


This help information is valid for iCube Engineer Online Help 2025.6

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