KEYENCE HostLink UDP communication library
Project description
kvhostlink.py
KEYENCE HostLink Communication for UDP/IP
Install
pip install kvhostlink-udp
Constructor
kvhostlink(host, timeout)
Functions
mode(mode)
Change Mode
0 = PROGRAM
1 = RUN
Retrun: EtherNet/IP Unit Response
unittype()
Checks PLC model
Retrun: EtherNet/IP Unit Response
errclr()
Removes the error in CPU unit
Retrun: EtherNet/IP Unit Response
er()
Confirm Error No
Retrun: EtherNet/IP Unit Response
settime()
Set up time of the CPU unit
Send the date and time of your computer
Retrun: EtherNet/IP Unit Response
set(address)
Forced Set
address = R0-199915, B0-7FFF, MR0-399915, LR0-99915, CR0-7915, T0-3999, C0-3999, CTC0-3, VB0-F9FF
Retrun: EtherNet/IP Unit Response
reset(address)
Forced Reset
address = R0-199915, B0-7FFF, MR0-399915, LR0-99915, CR0-7915, T0-3999, C0-3999, CTC0-3, VB0-F9FF
Retrun: EtherNet/IP Unit Response
sts(address)
Continuous Forced Set
address = R0-199915, B0-7FFF, MR0-399915, LR0-99915, CR0-7915, VB0-F9FF
num = number of written data
Retrun: EtherNet/IP Unit Response
rss(address, num)
Continuous Forced Reset
address = R0-199915, B0-7FFF, MR0-399915, LR0-99915, CR0-7915, VB0-F9FF
num = number of written data
Retrun: EtherNet/IP Unit Response
read(addresssuffix)
Data Read
addresssuffix = DeviceType + DeviceNo + DataFormat
.e.g. MR0, DM0.U
Return: EtherNet/IP Unit Response
reads(addresssuffix, num)
Consecutive Data Read
addresssuffix = DeviceType + DeviceNo + DataFormat
.e.g. MR0, DM0.U
num = number of read data
Return: EtherNet/IP Unit Response (Data1 + 0x20 + Data2 + 0x20 ...)
write(addresssuffix, data)
Write Data
addresssuffix = DeviceType + DeviceNo + DataFormat
.e.g. MR0, DM0.U
data = byte()
Return: EtherNet/IP Unit Response
writes(addresssuffix, data)
Write Consecutive Data
addresssuffix = DeviceType + DeviceNo + DataFormat
.e.g. MR0, DM0.U
data = byte() (data1 + 0x20 + data2 + 0x20 ...)
Return: EtherNet/IP Unit Response
mws(addresses)
Register monitor
addresses = DeviceType + DeviceNo + DataFormat
.e.g. 'DM0.H DM1.S DM2.L DM4.U DM5.D'
Return: EtherNet/IP Unit Response
mwr()
Read monitor
Return: EtherNet/IP Unit Response (Data1 + 0x20 + Data2 + 0x20 ...)
Example
from kvhostlink import kvHostLink
kv = kvHostLink('192.168.250.10')
data = kv.mode('1')
print(data) # b'OK\r\n'
data = kv.unittype()
print(data) # b'57\r\n'
data = kv.errclr()
print(data) # b'OK\r\n'
data = kv.er()
print(data) # b'000\r\n'
data = kv.settime()
print(data) # b'OK\r\n'
data = kv.set('MR0')
print(data) # b'OK\r\n'
data = kv.reset('MR1')
print(data) # b'OK\r\n'
data = kv.sts('MR10', 5)
print(data) # b'OK\r\n'
data = kv.rss('MR10', 4)
print(data) # b'OK\r\n'
data = kv.read('DM0.U')
print(data) # b'00002\r\n'
data = kv.reads('DM0.S', 4)
print(data) # b'+00002 +00001 +00002 +00003\r\n'
data = kv.write('DM0.U', '2')
print(data) # b'OK\r\n'
data = kv.writs('DM1.S', 4, '1 2 3 4')
print(data) # b'OK\r\n'
data = kv.mws('DM0.H DM1.S DM2.L DM4.U DM5.D')
print(data) # b'OK\r\n'
data = kv.mwr()
print(data) # b'0002 +00001 +0000196610 00004 0605955594\r\n'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kvhostlink_udp-0.1.2.tar.gz.
File metadata
- Download URL: kvhostlink_udp-0.1.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e66d5d55899e9423f5813ff4fed93fe17d8341420efadc218081b69f60c5bc04
|
|
| MD5 |
08315800029fee2af92a7e7d145f2ef7
|
|
| BLAKE2b-256 |
d7686963e4afae230902df45944ff16271e0c80072cb42e4b187096ff78a9ed7
|
File details
Details for the file kvhostlink_udp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: kvhostlink_udp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c27ef65375d86afcb4308af4d824460b5b82d8baabf2848ca24ee700eddcc4a
|
|
| MD5 |
a793e543791196d7bc1f4a12a62734f5
|
|
| BLAKE2b-256 |
f0c1eedf0b391282e2b1d23199571ee7d941f4047d196ca513245e4c5e0f9cea
|