日本語 English

Connecting with Host Link Communication (KEYENCE KV Series)

Overview

Explains the protocol of the Host Link communication function available on the EtherNet/IP port of KEYENCE KV series PLCs.
When the PLC receives a Host Link command, it returns the data corresponding to the command, so no ladder program is needed on the PLC.
Host Link communication via the EtherNet/IP port can use both the TCP/IP and UDP/IP protocols.

What Is Host Link Communication?

Serial and Ethernet communication in which a PC or host device sends ASCII-based commands to read/write devices (relays and data memory), change the mode and so on, without any ladder program on the PLC side.

Communication specifications

Communication specifications
ItemTCP/IPUDP/IP
Port number8501 (changeable)8501 (changeable)
Number of sockets15 (shared with MC protocol communication)1
Data codeASCII codeASCII code

Command list

Error responses

E0CRLF E0 : device number error
45H30H0DH0AH
E1CRLF E1 : command error
45H31H0DH0AH
E2CRLF E2 : program not registered
45H32H0DH0AH
E5CRLF E5 : main unit error
45H35H0DH0AH
E6CRLF E6 : no comment
45H36H0DH0AH

Command Reference

Mn

Change mode

Switches the CPU unit to PROGRAM mode or RUN mode

Command
MMode numberCR
4DH0DH

Mode number: 0 = PROGRAM, 1 = RUN

Normal response
OKCRLF
4FH4BH0DH0AH

ER

Clear error

Clears the error occurring in the CPU unit

Command
ERCR
45H52H0DH
Normal response
OKCRLF
4FH4BH0DH0AH

?E

Check error number

Checks errors and faults occurring in the CPU unit

Command
?ECR
3FH45H0DH
Normal response
Error number
CRLF
0DH0AH

* See the manual for error numbers

?K

Inquire model

Checks the PLC model

Command
?KCR
3FH4BH0DH
Normal response
Model number
CRLF
0DH0AH
Model
Model numberModel
57KV-8000
58KV-8000A
54KV-7300
55KV-7500
51KV-3000
52KV-5000
53KV-5500
128KV-NC32T
132KV-N60??
133KV-N40??
134KV-N24??

?M

Check operating mode

Checks the current operating state of the CPU unit

Command
?MCR
3FH4DH0DH
Normal response
Data
CRLF
0DH0AH

Data: RUN mode = 1, other than RUN mode = 0

WRT

Set time

Sets the time of the CPU unit

Command
Command2-digit yearMonthDayTime of dayMinuteSecondDay of week
WRT␣␣␣␣␣␣␣CR
57H52H54H20H0DH
Normal response
OKCRLF
4FH4BH0DH0AH

ST/RS

Force set / force reset

Forces the contact of the specified device ON or OFF

Force set command
ST␣Device type␣Device numberCR
53H54H0DH
Force reset command
RS␣Device type␣Device numberCR
52H53H0DH
Device type
RelaysR
Link relaysB
Internal auxiliary relaysMR
Latch relaysLR
Control relaysCR
TimersT
CountersC
High-speed counter comparatorCTC
Work relayVB
Normal response
OKCRLF
4FH4BH0DH0AH

STS/RSS

Consecutive force set / consecutive force reset

Forces the contacts of the specified number of devices ON or OFF

Consecutive force set command
STS␣Device type␣Device number␣Number of devices to writeCR
53H54H53H20H0DH
Consecutive force reset command
RSS␣Device type␣Device number␣Number of devices to writeCR
52H53H52H20H0DH
Device type
RelaysR
Link relaysB
Internal auxiliary relaysMR
Latch relaysLR
Control relaysCR
Work relayVB
Normal response
OKCRLF
4FH4BH0DH0AH

RD/RDS

Read data / read consecutive data

Reads the data of the specified device

Read data command
RD␣Device type␣Device numberData formatCR
52H44H20H0DH
Read consecutive data command
RD␣Device type␣Device numberData format␣Number of devices to readCR
52H44H20H0DH
Data format
.UDecimal 16-bit unsigned
.SDecimal 16-bit signed
.DDecimal 32-bit unsigned
.LDecimal 32-bit signed
.HHexadecimal 16-bit
Response
Data 1␣Data 2␣...Data nCRLF
20H0DH0AH

An example reading R100 to R103 in bit format

Command
RDS␣R100␣4CR
Response
1␣0␣1␣0CRLF

An example reading DM200 to DM202 in .S format

Command
RDS␣DM200.S␣3CR
Response
+15025␣-25400␣+00000CRLF

RDE

Read consecutive data

The RDE command is for compatibility with the KV-LE20A Ethernet unit and is the same as RDS

WR/WRS

Write data / write consecutive data

Reads the data of the specified device

Write data command
WR␣Device type␣Device numberData format␣DataCR
57H52H20H0DH
Write consecutive data command
WRS␣Device type␣Device numberData formatNumber of devices to write␣Data 1␣Data 2␣...Data nCR
57H52H53H20H0DH
Data format
.UDecimal 16-bit unsigned
.SDecimal 16-bit signed
.DDecimal 32-bit unsigned
.LDecimal 32-bit signed
.HHexadecimal 16-bit
Normal response
OKCRLF
4FH4BH0DH0AH

An example writing R100 to R103 in bit format

Command
WRS␣R100␣4␣1␣0␣1␣0CR
Response
OKCRLF

An example writing DM200 to DM202 in .S format

Command
WRS␣DM200.S␣3␣ +15025␣ -05400␣ 200 CR
Response
OKCRLF

WRE

Write consecutive data

The WRE command is for compatibility with the KV-LE20A Ethernet unit and is the same as WRS

WS/WSS

Write set value / write consecutive set values

The WS/WSS commands are for compatibility with the KV-LE20A Ethernet unit and are the same as WR/WRS

MBS/MWS

Register monitor

Registers the specified devices in the bit device registration table (MBS) or the word device registration table (MWS). Up to 120 devices can be registered

Bit device monitor registration command
MBS␣Device typeDevice number␣Device typeDevice number...Device typeDevice numberCR
4DH42H53H20H0DH
Word device monitor registration command
MWS␣Device typeDevice number␣Device typeDevice number...Device typeDevice numberCR
4DH42H53H20H0DH
Normal response
OKCRLF
4FH4BH0DH0AH

MBR/MWR

Read monitor

Reads the values of the devices in the device registration table

Command to read the bit device registration table
MBRCR
4DH42H52H0DH
Command to read the word device registration table
MWRCR
4DH42H52H0DH
Normal response
Data␣Data␣...DataCRLF

RDC

Read comment

Reads the comment of the specified device

Command to read the bit device registration table
RDC␣Device typeDevice numberCR
52H44H43H20H0DH
Normal response
DataCRLF

BE

Switch bank

Switches the file register bank

Bank switch command
BE␣Bank numberCR
42H45H20H0DH
Normal response
DataCRLF

URD

Read expansion unit buffer memory

Reads the specified number of data consecutively from expansion unit buffer memory

Read expansion unit buffer memory command
URD␣Unit number␣AddressData format␣Number of data to readCR
55H52H44H20H0DH
Normal response
Data␣Data␣...DataCRLF

UWR

Write expansion unit buffer memory

Writes the specified number of data consecutively to expansion unit buffer memory

Write expansion unit buffer memory command
UWR␣AddressData format␣Number of devices to write␣Data 1␣Data 2␣...Data nCR
55H57H52H20H0DH
Normal response
OKCRLF
4FH4BH0DH0AH

Related pages

TCP and UDP communication test tool

Analyze and test TCP and UDP communication

ComCom

An application that sends messages you create using Ethernet socket communication

Python Host Link communication

KEYENCE Host Link Communication

Host Link communication with KEYENCE PLCs

OMRON

Connecting to the KEYENCE KV series

Connecting to the KEYENCE KV Series

KvLink library for connecting an NX series and a KV series via Host Link, CIP communication and CIP communication with tag specification

Comments