---
title: "KNX Group Object DPT18"
canonical: "https://docs.cuesystem.com/space/CVCHELP/525172780/KNX%20Group%20Object%20DPT18"
format: markdown
---
> Macro (toc)

---

# Description

KNX Group Object DPT18 (scene control) is intended for activation or learning the scenes. The object allows numbering the scene from 0 to 63. If your device supports numbering from 1 to 64, use an offset of 1 in appropriate object commands.

|  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| Field | C |  | Scene Nr. |

# DPT Dimensions

|  |  |  |  |
| --- | --- | --- | --- |
| DPT Dimensions | Name | C | Scene Nr. |
| 18.001 | Scene control | 0 = activate scene | 0 - 63 |
| 1 = learn scene |

# WriteValue

This function transmits the KNX telegram, including the Byte newscenenumber and the Boolean newlearnscene, to the group address defined in the driver property. This function returns True if the function success, else it returns False. A function GetLastError returns the error number that occurred while executing the command. The errors that can happen: <u>[10000](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10000)</u>, <u>[10002](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10002)</u>, <u>[10003](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10003)</u>, <u>[10004](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10004)</u>.

#### Syntax

```visualbasic
Function WriteValue (
  newscenenumber As Byte,
  newlearnscene As Boolean,
  Optional highpriority As Boolean := False) 
As Boolean
```

#### Parameters

newscenenumber

Byte It is the number of the scene sent to the KNX bus. Value can be in the range of 0 – 63.

newlearnscene

Boolean If it is False, the scene is activated- If it is True, the scene is learned.

highpriority

Boolean Optional, defaults to False. If False, the command is applied with standard priority on the KNX bus. If it is True, the command is applied with a high priority on the KNX bus.

#### Return value

Boolean This function returns True on success or False if an error occurs. A function GetLastError returns the error number.

#### Example

```visualbasic
// Instance of Group object device driver DPT18 is named ObjectDPT18.

ObjectDPT18.WriteValue (18, False)
// Scene 18 is activated in the given group object on the KNX bus

ObjectDPT18.WriteValue (45, True)
// Scene 45 is learned in given group object on KNX bus
```

# GetValue

This function returns the last Byte scenenumber and last Boolean learnscene value of the group object with the given address received from the KNX bus.

***Syntax***

```visualbasic
Function GetValue(
  ByRef scenenumber As Byte,
  ByRef learnscene As Boolean)
```

#### Parameters

scenenumber

Byte This ByRef parameter is set to the last received scene number of the group object. Value can be in the range of 0 – 63

learnscene

Boolean This ByRef parameter is set to the last received learnedscene value of the group object. If it is False, the scene was activated. If it is True, the scene was learned.

# OnUpdate

This event is raised when receiving the KNX telegram with the appropriate group address. It returns the Byte newscenenumber value and Boolean newlearnscene value from the KNX telegram.

#### Syntax

```visualbasic
Event OnUpdate As Process (newscenenumber As Byte, newlearnscene As Boolean)
```

#### Parameters

newscenenumber

Byte It is the number of a scene received from the KNX bus. Value can be in the range of 0 – 63.

newlearnscene

Boolean If it is False, the scene was activated. If it is True, the scene was learned.

#### Example

```visualbasic
// Module DeviceEvents
// Instance of Group object device driver DPT18 is named ObjectDPT18.

Private Process ObjectDPT18_OnUpdate( newscenenumber As Byte, newlearnscene As Boolean ) Link ObjectDPT18.OnUpdate
  Var Tmp as Text[100]

  FormatText(Tmp, "Scene {n} was {l 'learned' 'activated'}.", newscenenumber, newlearnscene)
  Page1.StaticTextDPT18.SetText(Tmp)
End Process

// Graphic object StaticTextDPT18 displays text information of group
// object received from KNX bus
```