Connecting the WRF08 RS 485 MODBUS room control unit - introduction

Beckhoff Knowledge Base: Communication with the WRF08 RS485 MODBUS room control unit by Thermokon

引言

以下的例子中告诉你如何使 TwinCAT 和Thermokon的WRF08 8T RS485 MODBUS房间控制器进行通信 (www.thermokon.de)。这个例子仅限于基本功能，以便在应用程序中结合房间控制器。

这些是的不同版本的房间控制器和其所对应的按键数。该设备还拥有一个内部温度传感器。功能键和显示可以通过Modbus通信接口来扫描和控制。

要求

  • 装有TwinCAT PLC的Microsoft Windows (版本2.10以上) 用于编程与调试
  • TwinCAT PLC Modbus RTU (TwinCAT的软件库)
  • TwinCAT PLC 串口通信(TwinCAT的软件库)
  • TwinCAT 下的IEC 61131-3的编程知识
  • KL6041(串行接口 RS485)
  • Thermokon 的 WRF08

Overview

应用范例 | 注释
应用范例: PLC_KL6041.zip | Target platform CX (ARM)

所链接的库:


Connecting the WRF08 RS 485 MODBUS room control unit to a KL6041

Beckhoff Knowledge Base: Communication with the WRF08 RS485 MODBUS room control unit by Thermokon

将 WRF08 RS485 MODBUS 房间控制器连接到 一个KL6041

房间控制器有四个连接端子。端子1 (Net A) 和 2 (Net B)事数据输出。端子3 (24 V DC) 和 4 (GND) 用于供电。

关键是要按照制造商的安装说明 www.thermokon.de

将房间控制器连接到KL6041端子如下 :

KL6041上, pins 1 和 2 (Data +) 和 pins 5 和 6 (Data -) 必须互相连接.

端子设置

用KS2000软件将KKL6041设置为以下数值:

常规设置:

  • 在过程映像中设置为22数据字节
  • 半双工
  • 优化传输速率

RS485 接口参数:

  • 9600 波特
  • 8 位数据, 偶校验
  • 无校验
  • 1个停止位


WRF08-RS485-Modbus protocol description

Beckhoff Knowledge Base: Communication with the WRF08 RS485 MODBUS room control unit by Thermokon

WRF08-RS485-Modbus 协议描述

The WRF08-RS485-Modbus的协议描述可以从Thermokon company’s website下载。

注意: the WRF08-RS485-Modbus 进一步的信息同样可以从 Thermokon 获得(www.thermokon.de).


STOutRegs

TYPE STOutRegs :
STRUCT
  wButton                   : WORD;              (* Shows the state of the button: 1 = pressed; 0 = not pressed*)
  wButtonBufferd            : WORD;              (* Button press is stored intermediately until the next readout of the register*)
  iTemperature              : INT;               (* Temperature value measured by the internal temperature sensor, in tenths of a degree*)
  iSetTemp1Offset           : INT;               (* Setpoint temperature 1 offset*)
  wSetTemp1Effective        : WORD;              (* Setpoint temperature 1 effective*)
  iSetTemp2Offset           : INT;               (* Setpoint temperature 2 offset*)
  wSetTemp2Effective        : WORD;              (* Setpoint temperature 2 effective*)
  iSetPercent1Offset        : INT;               (* Setpoint percentage 1 offset*)
  wSetPercent1Effective     : WORD;              (* Setpoint percentage 1 effective*)
  iSetPercent2Offset        : INT;               (* Setpoint percentage 2 offset*)
  wSetPrecent2Effective     : WORD;              (* Setpoint percentage 2 effective*)
  iSetpoint1Offset          : INT;               (* Setpoint value 1 offset*)
  wSetpointEffective        : WORD;              (* Setpoint value 1 effective*)
  iSetpoint2Offset          : INT;               (* Setpoint value 2 offset*)
  wSetpoint2Effective       : WORD;              (* Setpoint value 2 effective*)
  wFanStage                 : WORD;              (* Fan stage *)
  wRoomOccupancy            : WORD;              (* Room occupancy *)
END_STRUCT
END_TYPE

这个结构包括房间控制器的输出寄存器状态(寄存器257 到寄存器 273).


STReadConfigRegs

TYPE STReadConfigRegs :
STRUCT
  wNumberOfButtons             : WORD;             (* WRF08 with the number of function operating buttons*)
  wDeviceLocationID            : WORD;             (* Device location ID*)
  wIllumRest                   : WORD;             (*Intensity of the LCD background lighting after 15 sec without pressing a button*)
  wIllumActive                 : WORD;             (* Intensity of the LCD background lighting when a button is pressed*)
  wIllumLabelRest              : WORD;             (* Intensity of the label background lighting after 15 sec without pressing a button*)
  wIllumLabelActive            : WORD;             (* Intensity of the label background lighting when a button is pressed*)
  wButtonT1                    : WORD;             (* Function button T1 *)
  wButtonT2                    : WORD;             (* Function button T2 *)
  wButtonT3                    : WORD;             (* Function button T3 *)
  wButtonT4                    : WORD;             (* Function button T4 *)
  wButtonT5                    : WORD;             (* Function button T5 *)
  wButtonT6                    : WORD;             (* Function button T6 *)
  wButtonT7                    : WORD;             (* Function button T7 *)
  wButtonT8                    : WORD;             (* Function button T8 *)
  wButtonT9                    : WORD;             (* Function button T9 *)
  wButtonT10                   : WORD;             (* Function button T10 *)
  wButtonT11                   : WORD;             (* Function button T11 *)
  wButtonT12                   : WORD;             (* Function button T12 *)
  wLEDT5                       : WORD;             (* Function LED T5 *)
  wLEDT6                       : WORD;             (* Function LED T6 *)
  wLEDT7                       : WORD;             (* Function LED T7 *)
  wLEDT8                       : WORD;             (* Function LED T8 *)
  wLEDT9                       : WORD;             (* Function LED T9 *)
  wLEDT10                      : WORD;             (* Function LED T10 *)
  wLEDT11                      : WORD;             (* Function LED T11 *)
  wLEDT12                      : WORD;             (* Function LED T12 *)
  wDispWeekday                 : WORD;             (* Display of the day of the week*)
  wDispDate                    : WORD;             (* Display of the date*)
  wDispTime                    : WORD;             (* Display of the time*)
  wDispTimeMode                : WORD;             (* Display of the time mode*)
  wDispUpdate                  : WORD;             (* Update interval of the display in seconds*)
  wMinResponseTime             : WORD;             (* Min. response time*)
  wCalibrationOffset           : WORD;             (* Temperature offset for calibrating the temperature sensor*)
  wTemp1UpperRange             : WORD;             (* Upper temperature setting range, set temperature 1*)
  wTemp1LowerRange             : WORD;             (* Lower temperature setting range, set temperature 1*)
  wJumpDistTemp1               : WORD;             (* Jump distance for set temperature 1 *)
  wSetTemp1                    : WORD;             (* Set temperature 1; basic setpoint after reset*)
  wTemp2UpperRange             : WORD;             (* Upper temperature setting range, set temperature 2 *)
  wTemp2LowerRange             : WORD;             (* Lower temperature setting range, set temperature 2 *)
  wJumpDistTemp2               : WORD;             (* Jump distance for set temperature 2 *)
  wSetTemp2                    : WORD;             (* Set temperature 2; basic setpoint after reset*)
  wAdjust1PercentUpper         : WORD;             (* Upper setting range, set percentage value 1*)
  wAdjust1PercentLower         : WORD;             (* Lower setting range, set percentage value 1 *)
  wJumpDist1Percent            : WORD;             (* Jump distance for set percentage value 1*)
  wSetTemp1Percent             : WORD;             (* Set percentage value 1; basic setpoint after reset*)
  wAdjust2PercentUpper         : WORD;             (* Upper setting range, set percentage value 2*)
  wAdjust2PercentLower         : WORD;             (* Lower setting range, set percentage value 2 *)
  wJumpDist2Percent            : WORD;             (* Jump distance for set percentage value 2*)
  wSetTemp2Percent             : WORD;             (* Set percentage value 2; basic setpoint after reset*)
  wUpperRange1Setpoint         : WORD;             (* Upper setting range, setpoint 1*)
  wLowerRange1Setpoint         : WORD;             (* Lower setting range, setpoint 1*)
  wJumpDist1Setpoint           : WORD;             (* Jump distance for setpoint 1*)
  wSetPoint1                   : WORD;             (* Setpoint 1; basic setpoint after reset*)
  wUpperRange2Setpoint         : WORD;             (* Upper setting range, setpoint 2*)
  wLowerRange2Setpoint         : WORD;             (* Lower setting range, setpoint 2*)
  wJumpDist2Setpoint           : WORD;             (* Jump distance for setpoint 2*)
  wSetPoint2                   : WORD;             (* Setpoint 2; basic setpoint after reset*)
  wFanStages                   : WORD;             (* Number of fan stages*)
END_STRUCT
END_TYPE

用户通过配置寄存器来实现房间控制器的参数化。每个参数都有预先定义的标准和预设值，可以用于满足不同应用的需要。