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.5.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fins-1.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 5d7ce0289fbf2b6a96eef5f9814dded917c86193ac6ff6fe71f40d0f55bd50e2
MD5 a3bca0a0e4a46f2829603c3a48a53435
BLAKE2b-256 e285f7da6de822cd37697787e3e49cb0f0f9d5b4e5678ec5d7d0db814eb920b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fins-1.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4ec970b297b93108b8e246e4c0e9822409f84c1ce973589b44cbe099145ee447
MD5 42434778707fadd2939cf3d7fc65378f
BLAKE2b-256 6ccb6068112fe79a421aead51824af3bdba1e32fa44100ce38c4b6b00f61c048

See more details on using hashes here.

Supported by

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