Function Blocks
Function blocks
MasterUDP (FB)
MasterUDP (FB)Overview
The MasterUDP function block serves as the KNX driver for communication with a KNX Net/IP gateway. It processes telegrams and coordinates communication with slave function blocks.
Inputs
xEnable
TRUE
Turn the function block on/off
sIPAddressKNXInterface
''
IP address of the KNX interface
uiPortKNXInterface
gc_LibPara.gc_uiPort
Port number of the KNX interface
itfNetworkInterface
-
Network interface for communication
uiPortPLC
gc_LibPara.gc_uiPortLocal
Port number of the PLC
xResError
FALSE
Error reset flag
tResponseTimeout
gc_LibPara.gc_tResponseTimeout
Timeout duration for requests
Outputs
xConnected(BOOL): Connection statusitfKnxConnector(IKnxConnector): Interface for slave blocksudiConnectedSlaves(UDINT): Number of connected moduleseStatus(KnxStatus): Current KNX connection statusstDeviceInfo(DeviceInfo): Device informationstKnxData(KnxData): KNX data structurebChannel(BYTE): Communication channel identifiereError(ErrorKnx): Current error statuseLastError(ErrorKnx): Last error
Usage
Configure the KNX interface with
sIPAddressKNXInterfaceanduiPortKNXInterface.Set
uiPortPLCaccording to your PLC configuration.Activate the block with
xEnable = TRUE.Monitor
xConnectedfor the connection status.Use
itfKnxConnectorto interact with slave blocks.Check
eStatusandeErrorregularly.Use
xResErrorto reset error states.
Notes
Ensure correct network settings (
itfNetworkInterface) are in place.Adjust
tResponseTimeoutif necessary to account for network latency.
General about KNX_Read_DPT_xx
KNX_Read_DPT_xx The usage of all KNX_Read_DPT_xx function blocks follows a similar pattern:
Configure group address:
Set
byAdrMainGroup(0-31)Set
byAdrMiddleGroup(0-7)Set
byAdrGroup(0-255)
Select DPT format:
Choose the desired format via
eDPT_Format
Configure read behavior:
For cyclic reading: Set
tRequestTimeto the desired intervalFor event-based reading: Use
xRequestorxRequestVisuif needed
Configure initialization:
Set
eInitOptiontoInitOption.PollingOnStartUporInitOption.InitValueWhen
InitOption.InitValue: Set the corresponding initial value:DPT_13x:
diInitValueDPT_14x:
rInitValueDPT_19x:
dtInitValue(not effective)
Monitor outputs:
Check
tNextRequestfor the time of the next read operationMonitor the corresponding value outputs:
DPT_13x:
diValue,rValueDPT_14x:
rValueDPT_19x:
wYear,wMonth,wDayOfMonth,wDayOfWeek,wHourOfDay,wMinutes,wSeconds
For DPT_13x and DPT_14x: Note
sUnitfor the unit
Error handling:
Monitor the error outputs of the parent SlaveBasic block
KNX_Read_DPT_1x (FB)
KNX_Read_DPT_1x (FB)Overview
Read function for DPT 1.x (1-bit).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 1.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
xInitValue
FALSE
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
xValue(BOOL): Received boolean valueEncoding(STRING[15]): Textual representation of the valuetNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 1.x format with
eDPT_Format.Configure the read options:
For cyclic reading:
tRequestTime> T#0SFor event-based reading: Use
xRequestorxRequestVisu
Set
eInitOptionand if applicablexInitValuefor initialization.Monitor
xValuefor received values andEncodingfor the textual representation.
KNX_Read_DPT_2x (FB)
KNX_Read_DPT_2x (FB)Overview
Read function for DPT 2.x (1-bit controlled).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 2.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
xInitValue
FALSE
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
xValue(BOOL): Received boolean valuexControlBit(BOOL): Received control bittNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 2.x format with
eDPT_Format.Configure the read options as with DPT 1.x.
Monitor
xValuefor the main value andxControlBitfor the control bit.
KNX_Read_DPT_5x (FB)
KNX_Read_DPT_5x (FB)Overview
Read function for DPT 5.x (8-bit unsigned).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 5.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
iInitValue
0
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
iValue(INT): Received integer valuesUnit(STRING[10]): Unit of the valuetNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 5.x format with
eDPT_Format.Configure the read options as with the previous blocks.
Monitor
iValuefor received values andsUnitfor the unit.
KNX_Read_DPT_6x (FB)
KNX_Read_DPT_6x (FB)Overview
Read function for DPT 6.x (8-bit signed).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 6.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
iInitValue
0
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
iValue(INT): Received integer valuesUnit(STRING[10]): Unit of the valuexStatus_AtoxStatus_E(BOOL): Status bits (only for DPT 6.020)xMode_0toxMode_2(BOOL): Mode bits (only for DPT 6.020)tNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 6.x format with
eDPT_Format.Configure the read options as with the previous blocks.
Monitor
iValuefor received values andsUnitfor the unit.For DPT 6.020: Note the additional status and mode bits.
KNX_Read_DPT_9x (FB)
KNX_Read_DPT_9x (FB)Overview
Read function for DPT 9.x (2-byte floating point).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 9.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
rInitValue
0.0
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
rValue(REAL): Received floating point valuesUnit(STRING[10]): Unit of the valuetNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 9.x format with
eDPT_Format.Configure the read options as with the previous blocks.
Monitor
rValuefor received values andsUnitfor the unit.
KNX_Read_DPT_13x (FB)
KNX_Read_DPT_13x (FB)Overview
Read function for DPT 13.x (4-byte signed value).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 13.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
diInitValue
0
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
diValue(DINT): Received integer valuerValue(REAL): Received floating point valuerFactor(REAL): Scaling factorsUnit(STRING[10]): Unit of the valuetNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 13.x format with
eDPT_Format.Configure the read options:
For cyclic reading:
tRequestTime> T#0SFor event-based reading: Use
xRequestorxRequestVisu
Set
eInitOptionand if applicablediInitValuefor initialization.Monitor
diValueorrValuefor received values andsUnitfor the unit.
KNX_Read_DPT_14x (FB)
KNX_Read_DPT_14x (FB)Overview
Read function for DPT 14.x (4-byte floating point value).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 14.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
rInitValue
0.0
Initial value when InitOption.InitValue
eInitOption
-
initialization option
Outputs
rValue(REAL): Received floating point valuesUnit(STRING[10]): Unit of the valuetNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 14.x format with
eDPT_Format.Configure the read options:
For cyclic reading:
tRequestTime> T#0SFor event-based reading: Use
xRequestorxRequestVisu
Set
eInitOptionand if applicablerInitValuefor initialization.Monitor
rValuefor received values andsUnitfor the unit.
KNX_Read_DPT_19x (FB)
KNX_Read_DPT_19x (FB)Overview
Read function for DPT 19.x (date and time).
Inputs
xRequest
FALSE
Trigger for single read
xRequestVisu
FALSE
Trigger for single read (visualization)
tRequestTime
T#0S
Interval for cyclic reading
eDPT_Format
-
DPT 19.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
dtInitValue
-
Initial value (not effective)
eInitOption
-
initialization option
Outputs
wYear(WORD): YearwMonth(WORD): MonthwDayOfMonth(WORD): Day of the monthwDayOfWeek(WORD): Day of the weekwHourOfDay(WORD): HourwMinutes(WORD): MinuteswSeconds(WORD): SecondstNextRequest(TIME): Time until the next read operation
Usage
Select the DPT 19.x format with
eDPT_Format.Configure the read options:
For cyclic reading:
tRequestTime> T#0SFor event-based reading: Use
xRequestorxRequestVisu
Set
eInitOptionfor initialization (note thatdtInitValueis not effective).Monitor the individual time components (wYear, wMonth, etc.) for received values.
KNX_Read_Data (FB)
KNX_Read_Data (FB)Overview
The KNX_Read_Data function block is used to receive KNX data without specific DPT conversion. It is particularly useful for progressive controls, such as in lighting control.
Inputs
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
Outputs
abyDaten(ARRAY[0..38] OF BYTE): Received raw data
Usage
Configure group address:
Set
byAdrMainGroup(0-31)Set
byAdrMiddleGroup(0-7)Set
byAdrGroup(0-255)
Data reception:
The block automatically receives data when it is sent to the configured group address.
The received data is stored in the
abyDatenarray.
Data processing:
The received data in the
abyDatenarray can be further processed as needed.Since no DPT conversion takes place, you must interpret the data yourself.
General about KNX_Write_DPT_xx
KNX_Write_DPT_xxThe usage of all KNX_Write_DPT_xx function blocks follows a similar pattern:
Configure group address:
Set
byAdrMainGroup(0-31)Set
byAdrMiddleGroup(0-7)Set
byAdrGroup(0-255)
Select DPT format:
Choose the desired format via
eDPT_Format
Set send value:
Set the value to be sent at the corresponding input:
DPT_1x:
xValue(BOOL)DPT_2x:
xValue(BOOL) andxPrio(BOOL)DPT_6x:
iValue(INT)DPT_9x:
rValue(REAL)DPT_13x:
diValue(DINT)DPT_14x:
rValue(REAL)
Configure send behavior:
For cyclic sending: Set
tTimeUpdateSetpto the desired intervalFor event-based sending: Set
xUpdateSetporxWriteVisuif neededOptional: Adjust
tPauseTimeUntilNextSendto configure the send pause
Monitor outputs:
Check
tNextWritefor the time of the next send operationMonitor the corresponding
*LastBusValueoutput for the last received valueFor DPT_1x: Also note
Encodingfor the textual representationFor DPT_2x: Also note
xControlBitfor the priority status
Observe unit:
For DPT_6x, DPT_9x, DPT_13x, DPT_14x: Check
sUnitfor the current unit
Error handling:
Monitor the error outputs of the parent SlaveBasicWr block
KNX_Write_DPT_1x (FB)
KNX_Write_DPT_1x (FB)Inputs
xUpdateSetp
FALSE
Trigger for setpoint update
xValue
-
BOOL value to send
xWriteVisu
-
Trigger for single send
eDPT_Format
-
DPT 1.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
tTimeUpdateSetp
T#0S
Cyclic update interval
tPauseTimeUntilNextSend
T#3S
Send pause
Outputs
Encoding(STRING[15]): Textual representation of the valuetNextWrite(TIME): Time until the next write operationxLastBusValue(BOOL): Last received value
Usage
Select the DPT 1.x format with
eDPT_Format.Set the value to be sent in
xValue.Configure the send options:
For cyclic sending:
tTimeUpdateSetp> T#0SFor event-based sending: Use
xUpdateSetporxWriteVisu
Monitor
xLastBusValuefor received values.Note
Encodingfor the textual interpretation of the value.
KNX_Write_DPT_2x (FB)
KNX_Write_DPT_2x (FB)Overview
Send function for DPT 2.x (2-bit value).
Inputs
xUpdateSetp
FALSE
Trigger for setpoint update
xValue
-
Main value to send (BOOL)
xPrio
-
Priority value to send (BOOL)
xWriteVisu
-
Trigger for single send
eDPT_Format
-
DPT 2.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
tTimeUpdateSetp
T#0S
Cyclic update interval
tPauseTimeUntilNextSend
T#3S
Send pause
Outputs
tNextWrite(TIME): Time until the next write operationxLastBusValue(BOOL): Last received main valuexControlBit(BOOL): Last received control bit (priority)
Usage
Select the DPT 2.x format with
eDPT_Format.Set the main value to send in
xValueand the priority value inxPrio.Configure the send options:
For cyclic sending:
tTimeUpdateSetp> T#0SFor event-based sending: Use
xUpdateSetporxWriteVisu
Monitor
xLastBusValuefor the last received main value.Note
xControlBitfor the last received priority value.
KNX_Write_DPT_6x (FB)
KNX_Write_DPT_6x (FB)Overview
Send function for DPT 6.x (8-bit signed value).
Inputs
xUpdateSetp
FALSE
Trigger for setpoint update
iValue
-
INT value to send
xWriteVisu
-
Trigger for single send
uiDelta
1
Threshold for value-change detection
eDPT_Format
-
DPT 6.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
tTimeUpdateSetp
T#0S
Cyclic update interval
tPauseTimeUntilNextSend
T#3S
Send pause
Outputs
sUnit(STRING[10]): Unit of the valuetNextWrite(TIME): Time until the next write operationiLastBusValue(INT): Last received value
Usage
Select the DPT 6.x format with
eDPT_Format.Set the value to be sent in
iValue.Configure the send options:
For cyclic sending:
tTimeUpdateSetp> T#0SFor event-based sending: Use
xUpdateSetporxWriteVisu
Adjust
uiDeltato adjust the sensitivity for value changes.Monitor
iLastBusValuefor received values andsUnitfor the unit.
KNX_Write_DPT_9x (FB)
KNX_Write_DPT_9x (FB)Overview
Send function for DPT 9.x (2-byte floating point).
Inputs
xUpdateSetp
FALSE
Trigger for setpoint update
rValue
-
REAL value to send
xWriteVisu
-
Trigger for single send
rDelta
0.05
Threshold for value-change detection
eDPT_Format
-
DPT 9.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
tTimeUpdateSetp
T#0S
Cyclic update interval
tPauseTimeUntilNextSend
T#3S
Send pause
Outputs
sUnit(STRING[10]): Unit of the valuetNextWrite(TIME): Time until the next write operationrLastBusValue(REAL): Last received value
Usage
Select the DPT 9.x format with
eDPT_Format.Set the value to be sent in
rValue.Configure the send options:
For cyclic sending:
tTimeUpdateSetp> T#0SFor event-based sending: Use
xUpdateSetporxWriteVisu
Adjust
rDeltato adjust the sensitivity for value changes.Monitor
rLastBusValuefor received values andsUnitfor the unit.
KNX_Write_DPT_13x (FB)
KNX_Write_DPT_13x (FB)Overview
Send function for DPT 13.x (4-byte signed integer).
Inputs
xUpdateSetp
FALSE
Trigger for setpoint update
diValue
-
DINT value to send
xWriteVisu
-
Trigger for single send
uiDelta
1
Threshold for value-change detection
eDPT_Format
-
DPT 13.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
tTimeUpdateSetp
T#0S
Cyclic update interval
tPauseTimeUntilNextSend
T#3S
Send pause
Outputs
rFactor(REAL): Conversion factorsUnit(STRING[10]): Unit of the valuetNextWrite(TIME): Time until the next write operationdiLastBusValue(DINT): Last received valuerLastBusValue(REAL): Last received value as REAL
Usage
Select the DPT 13.x format with
eDPT_Format.Set the value to be sent in
diValue.Configure the send options:
For cyclic sending:
tTimeUpdateSetp> T#0SFor event-based sending: Use
xUpdateSetporxWriteVisu
Adjust
uiDeltato adjust the sensitivity for value changes.Monitor
diLastBusValueorrLastBusValuefor received values.Note
rFactorfor any conversions andsUnitfor the unit.
KNX_Write_DPT_14x (FB)
KNX_Write_DPT_14x (FB)Overview
Send function for DPT 14.x (4-byte floating point).
Inputs
xUpdateSetp
FALSE
Trigger for setpoint update
rValue
-
REAL value to send
xWriteVisu
-
Trigger for single send
rDelta
0.5
Threshold for value-change detection
eDPT_Format
-
DPT 14.x format selection
byAdrGroup
0
Group address (0-255)
byAdrMiddleGroup
0
Middle group address (0-7)
byAdrMainGroup
0
Main group address (0-31)
tTimeUpdateSetp
T#0S
Cyclic update interval
tPauseTimeUntilNextSend
T#3S
Send pause
Outputs
sUnit(STRING[10]): Unit of the valuetNextWrite(TIME): Time until the next write operationrLastBusValue(REAL): Last received value
Usage
Select the DPT 14.x format with
eDPT_Format.Set the value to be sent in
rValue.Configure the send options:
For cyclic sending:
tTimeUpdateSetp> T#0SFor event-based sending: Use
xUpdateSetporxWriteVisu
Adjust
rDeltato adjust the sensitivity for value changes.Monitor
rLastBusValuefor received values andsUnitfor the unit.
Last updated

