Skip to main content

A library to communicate with Omron controllers using Factory Intelligent Network Service (FINS)

Project description

Omron FINS Driver in Python 3

This project is a Python 3 library for communicating with Omron PLC's that use the FINS (Factory Intelligent Network Services) protocol. This library will allow the programmer to write a platform independent computer program to supervise and modify memory areas in the PLC for reporting or providing user input into the PLC. This project has been tested on an extremely limited amount of hardware, so please confirm that it works with your system. Omron has been pretty consistent with how they implement FINS across PLC platforms, so I'm optimistic that it will work for most systems using Ethernet based CP/CS/CJ processors, but as stated in the license, this code is provided "as-is" with the user being responsible for determining suitability.

If you're interested in trying it out, or just taking a look at it to see how the FINS protocol works, you can download it from my GitHub Page.

documentation

Examples

The following program demonstrates the most common application, which is reading and writing to memory areas. The program below will set the five low bits of CIO 100 (write 0x1f) , read them back, and then reset the five low bits ( write 0x00) and read them back. For the CP1 PLC that I am using, those five bits correspond to the relay outputs, so if you have a similar system, you would hear the relays click on and off.

import fins.udp
import time

fins_instance = fins.udp.UDPFinsConnection()
fins_instance.connect('192.168.250.1')
fins_instance.dest_node_add=1
fins_instance.srce_node_add=25

for i in range(2):
    fins_instance.memory_area_write(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00',b'\x00\x1f',1)
    mem_area = fins_instance.memory_area_read(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00')
    print(mem_area)
    time.sleep(1)
    fins_instance.memory_area_write(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00',b'\x00\x00',1)
    mem_area = fins_instance.memory_area_read(fins.FinsPLCMemoryAreas().CIO_WORD,b'\x00\x64\x00')
    print(mem_area)
    time.sleep(1)

Another useful application would be to transfer the program from the PLC into a hex file so that it could be transferred into another PLC of the same model. This might be necessary if you wanted to send an updated program to a customer PLC that does not have Omron's CX-One programming suite. The code below will connect to the PLC and transfer the program and store it in a file named "plcprogram.hex".

import fins.udp
import time

fins_instance = fins.udp.UDPFinsConnection()
fins_instance.connect('192.168.250.1')
fins_instance.dest_node_add=1
fins_instance.srce_node_add=25

fins_instance.plc_program_to_file('plcprogram.hex')

If you want to turn around and download that program to the same model of PLC you could use the follow code (assuming your "plcprogram.hex" file is in the same directory as where you execute the Python code, otherwise use relative or absolute paths appropriate for your operating system):

import fins.udp
import time

fins_instance = fins.udp.UDPFinsConnection()
fins_instance.connect('192.168.250.1')
fins_instance.dest_node_add=1
fins_instance.srce_node_add=25

fins_instance.file_to_plc_program('plcprogram.hex')

Notes

The source code also contains a fins.usb connection, but it does not work (nor was it intended to work) with the driver that Omron ships with their CX-One suite. It requires the user to generate their own USB driver with a package like LibUSBK, and use Omron's Vendor ID and Product ID. I would not recommend it unless you have a very good idea what you are doing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fins-1.0.4.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

fins-1.0.4-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file fins-1.0.4.tar.gz.

File metadata

  • Download URL: fins-1.0.4.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for fins-1.0.4.tar.gz
Algorithm Hash digest
SHA256 04120a0e3b63d9597f2e97bf4d5e11bf9a9a7c4ae794e2a924e8f87c9d7fb756
MD5 d3fccba48f6287a92e59458cd58cbe5e
BLAKE2b-256 f86c81825bd15255565cf39677cc3abd1f41362b97b303045479019939684331

See more details on using hashes here.

File details

Details for the file fins-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: fins-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for fins-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6c58242e4f634a0ac36d2bbbba496a6628cf8e0acabe6af409fba12107cc6073
MD5 b56f9ffac03e77df4cdf3a62f7c96565
BLAKE2b-256 8195cc046aa9dffddb1517812007123612170df87c16b3075f9ccad71800ea72

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page