Chapter 8 Communication Functions

8.3.4Instruction and example

1)MODBUS communication instruction(MODCOM)

MODCOM

MODBUS communication

Instruction

 

 

 

 

Available device

 

 

 

No. of

 

Flag

 

 

 

 

 

 

 

 

 

 

 

 

 

 

M

P

K

L

F

T

C

S

D

#D integer

steps

Error

Zero

Carry

 

 

 

(F110)

(F111)

(F112)

 

 

 

 

 

 

 

 

 

 

 

 

Ch

 

 

 

 

 

 

 

 

 

 

 

 

S1

○ ○

 

 

 

 

 

 

 

 

 

 

7

S2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flag

Designation

 

 

 

 

 

 

 

 

 

 

 

Ch

Designated communication channel

 

 

 

 

 

 

 

 

 

Error

Error flag turns on when designating area is over

 

S1

Device which is registered communication parameter

 

 

 

 

 

 

 

(F110)

and the instruction isn’t executed

 

 

 

 

 

 

S2

Device which stored communication data

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S3

Device which stored communication status

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

MODCOM Ch S1 S2 S3

(1)Example program

Designate slave station No. , function code,.address, No. of reading

When input condition(M0020) turns on, MODBUS communication starts.

Receiving data are stored D1000, and communication status is stored to M100

When operates as slave, MASTER-K120S responses to master station without commands. And When operates as master, MASTER-K120S sends data in S1 with MODBUS protocol at rising edges of execution condition.

8-62

Page 252
Image 252
LG Electronics 120S Communication Functions Instruction and example, Modbus communication instructionMODCOM, Modcom