PLC To PID Modbus Examples PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

12.

Communication Design Examples

12.6 Communication between PLC and Delta DTA Series Temperature Controller
(MODRD/MODWR)

Control Purpose:

z Reading the target value and the set value of the temperature controller (TC). (address:
H4700, MODRD instruction)
z Setting the target temperature as 24° (address H4701, MODWR instruction)
z Setting the heating/cooling control cycle. (address: H4712, MODWR instruction)
z Setting the control mode as cooling. (address: H4718, MODWR instruction)

Parameter Settings for DTA Series Temperature Controller:

Parameter Function Set value

C WE: Write-in function disable/enable ON


C-SL: ASCII, RTU communication format selection ASCII
C NO: Communication address setting 1
BPS: Communication baud rate setting 9600
LENGTH: Data length setting 7
PARITY: Parity bit setting E
STOP BIT: Stop bit setting 1
UNIT: Temperature display unit °C or ℉ °C

Ú If TC can not run normally due to improper parameters, users can set the TC to factory
defaults first and then set the parameters according to the above table.

Steps of setting factory defaults:

1. Press in the main screen to enter page. Use to select . Press


to save the setting.
2. Press both and for about 1s to enter default setting mode. (Other operation is
prohibited in this mode, or setting error will occur, and the TC have to be sent back to
factory for adjusting)

3. In page, press to set as . Press to save the setting.


4. Turn off TC then power up again.
5. The communication protocols of DTA series TC are as follows:
z Supporting MODBUS ASCII/RTU. Baud rate: 2400, 4800, 9600, 19200, 38400.
z Supporting function codes: 03H (read multiple words). 06H (write 1 word).
Non-supporting function code: 10H (write multiple words).
z Non-supporting formats in ASCII mode: 7, N, 1 or 8, O, 2 or 8, E, 2.
z Supporting formats in RTU mode: 8, N, 1 or 8, N, 2 or 8, O, 1 or 8, E, 1.
z Available communication address: 1 to 255, 0 is broadcast address.

12-22 DVP-PLC Application Examples


12. Communication Design Examples

Devices:

Devices Function

M0 Execute MODRD instruction to read target and current temperature.


M1 Execute the first MODWR instruction to set target temperature of TC.
M2 Execute the 2nd MODWR instruction to set the heating/cooling cycle time.
M3 Execute the 3rd MODWR instruction to set the control mode as Cooling.

Control Program:

M1002
Set communication
MOV H86 D1120 format: 9600, 7, E, 1

SET M1120 Retain communication setting

Set receiving time-out:


MOV K500 D1129 500ms

Select communication mode:


RST M1143
MODBUS ASCII

LD= C0 K0 M0 Execute MODRD instruction

LD= C0 K1 M1 Execute the 1st MODWR instruction

LD= C0 K2 M2 Execute the 2nd MODWR instruction

LD= C0 K3 M3 Execute the 3rd MODWR instruction

LD= C0 K4 RST C0

M0
SET M1122 Sending request
M1

M2

M3

M0
MODRD K1 H4700 K2
Read the target value and the present value of the
M1 TC and store them in D1050 and D1051
MODWR K1 H4701 K240

Set the TC target value as 24℃

DVP-PLC Application Examples 12-23


12. Communication Design Examples

M2
MODWR K1 H4712 K20

Set the heating/cooling cycle time: 20s


M3
MODWR K1 H4718 K1
Set temperature control mode: cooling mode
M1127
C0 counts once
CNT C0 K10 when data receiving
is completed.
RST M1127 Reset M1127
M1129 C0 counts once
CNT C0 K10 when communication
timeout occurs

RST M1129 Reset M1129


M1140 C0 counts once
CNT C0 K10 when data receiving
error occurs

RST M1140 Reset M1140


M1141 C0 counts once
CNT C0 K10 when parameter
error occurs

RST M1141 Reset M1141

Program Description:

z Initialize PLC RS-485 communication port and set the communication format as MODBUS
ASCII, 9600, 7, E, 1. The RS-485 communication format of TC should be the same with
PLC.

z Since DTA series TC does not support the function code 10H (Write multiple words), the
program needs 3 MODWR instructions to write 3 address data.
z There are only 4 situations for MODBUS communication: flag M1127 for normal
communication and M1129, M1140, M1141 for communication errors. Counter C0 counts
once when any of the 4 flags is ON. Therefore, the program assures the communication
reliability by monitoring the On/Off status of the 4 flags and performs 4 MODBUS
instructions in order by the value in counter C0
z Once PLC starts running, the read/write actions for TC will be performed repeatedly
according to [LD=] instructions.

12-24 DVP-PLC Application Examples


12. Communication Design Examples

12.7 Communication between PLC and Delta DTB Series Temperature Controller
(MODRD/MODWR/MODRW)

Control Purpose:

z Reading as well as displaying the target value and the present value of the TC by MODRD
instruction.
z Setting the parameters of the TC as following data by MODWR and MODRW instructions.

Parameter value Communication address

Target temperature 26°C 1001H


Upper limit of temperature range 50°C 1002H
Lower limit of temperature range 0°C 1003H
Output type of alarm 1 The first alarm type 1020H
Upper-limit alarm 1 5°C 1024H
Lower-limit alarm 1 3°C 1025H

Parameter Settings for DTB Series Temperature Controller:

Parameter Function Set value

C WE: Write-in function disable/enable ON


C-SL: ASCII, RTU communication format selection RTU
C NO: Communication address setting 1
BPS: Communication baud rate setting 9600
LENGTH: Data length setting 8
PARITY: Parity bit setting N
STOP BIT: Stop bit setting 2
UNIT: Temperature display unit °C or ℉ °C

Ú If TC can not run normally due to improper parameters, users can set the TC to factory
defaults first and then set the parameters according to the above table. The setting steps of
DTB series are the same with DTA series TC.
Ú Communication protocol of DTB series is as following:
1. Supporting MODBUS ASCII/RTU communication protocol. Communication baud rate:
2400, 4800, 9600, 19200, 38400.
2. Supporting function code: 03H to read the contents of register. 06H to write 1 word into
register. 10H to write many words into register.
3. Non-supported formats in ASCII mode: 7, N, 1 or 8, O, 2 or 8, E, 2
4. Formats in RTU mode: 8, N, 1 or 8, N, 2 or 8, O, 1 or 8, E, 1.
5. Available communication address: 1 to 255, 0 is broadcast address.

Devices:

Device Function

DVP-PLC Application Examples 12-25


12. Communication Design Examples

Device Function

M0 Executing MODRD instruction to read target and present temperature


M1 Executing the 1st MODWR instruction to set target temperature of TC
M2 Executing the 2nd MODWR instruction to set alarm output type
Executing the 1st MODRW instruction to set the upper/lower limit of
M3
temperature range
M4 Executing the 2nd MODRW instruction to set the upper/lower limit of alarm 1

Control Program:

M1002
Set up communication
MOV H89 D1120 format: 9600,8,N,2

SET M1120 Retain communication setting

Set receiving time-out:


MOV K100 D1129 100ms

Select communication mode:


SET M1143
MODBUS RTU

MOV K500 D0 Upper limit of temp.


Range:50℃

MOV K0 D1 Lower limit of temp.


Range:0℃
Upper-limit of the
MOV K50 D2 alarm: 5℃

Lower-limit of the
MOV K30 D3
alarm:3℃

LD= C0 K0 M0 Execute MODRD instruction

LD= C0 K1 M1 Execute the 1st MODWR instruction

LD= C0 K2 M2 Execute the 2nd MODWR instruction

LD= C0 K3 M3 Execute the 1st MODRW instruction

LD= C0 K4 M4 Execute the 2nd MODRW instruction

LD= C0 K5 RST C0

M0
SET M1122 Sending request
M1

M2

M3

M4

12-26 DVP-PLC Application Examples


12. Communication Design Examples

M0
MODRD K1 H1000 K2
Read the target value and the present value of the
TC and store them in D1073~D1076
M1
MODWR K1 H1001 K260

Set target value as 26℃


M2
MODWR K1 H1020 K1

Set output mode of alarm 1 as the 1st alarm type


M3
MODRW K1 K16 H1002 D0 K2

Set upper/lower limit of temperature range


M4
MODRW K1 K16 H1024 D2 K2

Set the upper/lower limit of alarm 1


M1127 C0 counts once
CNT C0 K10 when data receiving
is completed.

RST M1127 Reset M1127


M1129 C0 counts once
CNT C0 K10 when communication
timeout occurs.

RST M1129 Reset M1129


M1140 C0 counts once
CNT C0 K10 when data receiving
errors occurs.

RST M1140 Reset M1140


M1141 C0 counts once
CNT C0 K10 when parameter error
occurs.

RST M1141

Program Description:

z Initialize PLC RS-485 communication port and set the communication format as MODBUS
RTU, 9800, 8, N, 2. The RS-485 communication format of TC should be the same with PLC..

z There are only 4 situations for MODBUS communication: flag M1127 for normal
communication and M1129, M1140, M1141 for communication errors. Counter C0 counts
once when any of the 4 flags is ON. Therefore, the program assures the communication
reliability by monitoring the On/Off status of the 4 flags and performs 5 MODBUS
instructions in order by the value in counter C0.

z Since DTB series TC supports the function code 10H, the program uses MODRW instruction
to write multiple words.
z Once PLC starts running, the read/write actions for TC will be performed repeatedly
according to [LD=] instructions.

DVP-PLC Application Examples 12-27

You might also like