Skip to main content

Python FINS driver for Omron PLC

Project description

fins-driver

FINS (Factory Interface Network Service) Python driver for Omron PLC.

Installation

Install the latest version from PyPI by typing this command:

pip install -U fins-driver

Usage

Below is an example on how to use the client class.

from fins import FinsClient

client = FinsClient(host='192.168.250.1', port=9600)
response = client.memory_area_read('D0')
print(response.data)
client.close()

Memory Area Read

.memory_area_read(address: str | bytes, num_items: int = 1) -> Response[bytes]

Examples:

Read DM area at word 0.

response = client.memory_area_read('D0')

Read CIO area at word 100 and bit 01.

response = client.memory_area_read('CIO100.01')

Memory Area Write

.memory_area_write(address: str | bytes, data: bytes, num_items: int = 1) -> Response[bytes]

Examples:

Write to CIO area at word 100. It will turn on CIO100.00 and CIO100.01. Hex value \x00\x03 is translated to 0000 0000 0000 0011 in binary.

response = client.memory_area_write("CIO100", b"\x00\x03")

Write to CIO area at word 100 and bit 01. We only need to provide 1 bytes data to write bit status. Hex value \x01 is translated to ON, while \x00 is translated to OFF.

response = client.memory_area_write("CIO100.01", b"\x01")

Memory Area Fill

.memory_area_fill(address: str | bytes, data: bytes, num_items: int = 1) -> Response[bytes]

Examples:

Fill DM area word with \x00\x03.

response = client.memory_area_fill("D0", b"\x00\x03")

Multiple Memory Area Read

.multiple_memory_area_read(*addresses: str | bytes) -> Response[List[bytes]]

Examples:

Read multiple memory area words.

response = client.multiple_memory_area_read("D0", "D1")

Read multiple memory area bits.

response = client.multiple_memory_area_read("CIO100.00", "CIO100.01")

Memory Area Transfer

.memory_area_transfer(source_address: str | bytes, dest_address: str | bytes, num_items: int = 1) -> Response[bytes]

Examples:

Transfer memory area word from D0 to D1.

response = client.memory_area_transfer("D0", "D1")

Run

.run(mode: debug | monitor | run = "monitor", program_number: bytes = b"\xff\xff") -> Response[bytes]

Examples:

Change PLC to run in monitor mode.

response = client.run("monitor")

Stop

.stop() -> Response[bytes]

Examples:

Stop PLC device.

response = client.stop()

Forced Set/Reset

.forced_set_reset(*specs: SetResetSpec) -> Response[bytes]

Examples:

Force-set ON the CIO0.01.

from fins import SetResetSpecCode, SetResetSpec

response = client.forced_set_reset(SetResetSpec(SetResetSpecCode.FORCE_SET, "CIO0.01"))

Forced Set/Reset Cancel

.forced_set_reset_cancel() -> Response[bytes]

Examples:

Cancel all bits that have been forced ON or OFF.

response = client.forced_set_reset_cancel()

Memory Areas

Below is supported memory areas prefix.

Prefix Description
CIO Core IO area
W Work area
H Holding area
A Auxiliary area
D Data Memory area

For the core IO area, you can omit the prefix. For example, address 100.01 is the same as CIO100.01.

Response Object

Property/Method Type Description
data T Response data. Refer to each command to see data type.
code bytes Response code, primarily \x00\x00 if it's OK.
status_text str Textual description of the response code.
ok bool True if request was OK (Normal completion).
raw_data bytes Original unparsed response data.
raw bytes The overall raw content of response.
header Header Response header data.
command Command The request command that was sent to the device.

License

MIT

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_driver-0.3.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

fins_driver-0.3.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file fins_driver-0.3.1.tar.gz.

File metadata

  • Download URL: fins_driver-0.3.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for fins_driver-0.3.1.tar.gz
Algorithm Hash digest
SHA256 20c8119117fd566b42b1c4bc61f19836ab3c322ba855df4d910f83f2b406415f
MD5 a4eb77f469fd8196130846856827f0eb
BLAKE2b-256 988bffeb06b1445be599cda7b81d3f26cd67a472de363c6eb74054c78377b24f

See more details on using hashes here.

File details

Details for the file fins_driver-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: fins_driver-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for fins_driver-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89c94d462757dc059718df70aeac371234184a97c8a62e09a19f8ee06241ca45
MD5 cd97cdff592e3f307d41b0ae64695009
BLAKE2b-256 c913f08e544ebeabccb7c2df41fbfe303614b143284e75c6a49df6e69fcd95ea

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