translation missing: en.general.accessibility.skip_to_content Access Technical Experts 100's of Free Guides 365 Day Guarantee Z-Wave & Zigbee Specialists

# KB-104 - Z-Wave Device Parameters - hex, dec, binary, bits, bytes ..... what?!?!

While reading through device manuals or our own guides you may come across some terms you may not be familiar with such as Binary, Hexadecimal, bit, byte, etc.

This is a quick guide to the common terms used so that we're all talking about the same things.

## Introduction to Binary, Decimal and Hexadecimal Numbers

While this may sound confusing at first, Binary, Decimal and Hexadecimal are essentially just different ways of writing down a number.

Lets take a quick look at the differences between them.

### Decimal

There’s not much to be said about the decimal system given that is the most common used system nowadays.

It’s called a “Base 10” system because there are 10 symbols that can be used: 0 – 9.

Once you reach 9 you run out of symbols so you add 1 digit on the left and start again at 0.

### Binary

A Binary Number is made up of only 0s and 1s. For that reason it’s called a “Base 2” system.

This means a single Binary digit can show only 2 different values instead of the usual 10 digits.

The general rule to counting using Binary system is the same as the Decimal system: count up until just before the "Base", then start at 0 again, but first you add 1 to the number on your left.

 Binary: Decimal: 0 1 10 11 100 101 110 111 1000 1001 1010 0 1 2 3 4 5 6 7 8 9 10

Hexadecimal number are quite interesting given that it’s a “Base 16” system.

They look the same as the decimal numbers up to 9, but then there are the letters ("A',"B","C","D","E","F") in place of the decimal numbers 10 to 15.

A single Hexadecimal digit can show 16 different values instead of the normal 10 digits we’re used to.

Again once we run out of symbols (when we reach F) we start back at 0, and we add 1 to the next position on the left.

 Hexadecimal: Decimal: 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

### See it in action

Choose one of the systems bellow and watch it count:

### Conversion between systems

If you’re really into math you can teach yourself how to convert numbers between different base systems.

The easiest way however is to use an online Number Converter.

## Bits vs Bytes

Bits and Bytes are often confused but in fact there's a big difference between them.

A bit is the smallest unit of information that can be stored or manipulated on a computer. When represented as a number, bits can have a value of either "1" (one) or "0" (zero).

On the other hand a byte is much bigger, it contains eight bits. Mathematically n bits yields 2 ^ n patterns so a byte can hold a number between 0 and 255.

 bit   value 0 1 2 3 4 5 6 7 2 ^ 0 2 ^ 1 2 ^ 2 2 ^ 3 2 ^ 4 2 ^ 5 2 ^ 6 2 ^ 7 0 2 4 8 16 32 64 128

It is important to know that bytes are abbreviated with a capital B, where as bits use a lowercase b. Therefore, Mbps is megabits per second, and MBps is megabytes per second.

## Tying it all together

You may wondering why we’ve been talking about bits, bytes and all those different number systems.

When adding a device Parameter you have to choose its Data Size. Between 1, 2 or 4 bytes and Hex or Dec there are 6 options to choose from.

You may feel tempted to just choose the first option and move on with it but a wrong Data Size Parameter won’t work at all and in some occasions it can prevent the device itself from working properly.

### Data Size

First thing to know is unless stated otherwise all Parameters are 1 byte decimal.

However there are some devices that require other data sizes. For that reason it’s extremely important to carefully read your devices’ manual before doing any changes.

We do our best to keep all product pages with up to date manuals.

On the rare occasion that we’re missing a manual or the information presented there is not clear enough our suggestion is to search for your device at pepper1 Z-wave database or the Z-Wave Alliance website.

### Negative values

It’s common sense to use a minus sign to designate a negative integer. However, computers can only store information in bits, which as we’ve seen can only have the values zero or one. Therefore the storage of negative integers in a Parameter will require a different approach.

Without going into details one way to store negative values is to use the Two’s Complement convention where negative values are represented by the two’s complement of their own value. This basically means that numbers that have a “1” in the left most bit are negative.

To set negative values on a Parameter you take the maximum value (depending on the parameter size, i.e. 1, 2 or 4 bytes) and subtract the desired value.

## Examples

Everything is easier to understand with an example so lets look at some every-day devices that require some bit math before setting its Parameters.

### Philio Multisensor GEN5

A quick look at the Philio Multisensor manual and one immediately notices most of its Parameter values are not the usual 1 byte decimal.

Lets take Parameter 7 as an example. Note: for this example we’ll use the PST02-1A Parameters.

We need to enable Binary Sensor Report Command Class and make the device report “clear” after a motion event to get both Motion and Magnet sensors working in most Z-Wave controllers.

To do this we need to enable bit 1 and bit 4 and add that to the already enabled by default bit 2.

This translates to: (2 ^ 1) + (2 ^ 2) + (2 ^ 4) = 22

So our 1 byte decimal Parameter should be set to 22.

### Aeon Clamp Meter

The 4 byte decimal Parameters used by the Aeon Clamp Meter can be tricky when compared to a 1 byte decimal Parameter.

As an example lets say we want to configure a Single Clamp version of this device. We’ve learned here that Parameter 103 should be set to 2304 but why’s that?

If we look at the manual we can see in page 7 a table showing all the possible options for Value 1 to 4.

It also tell us that Value 1 is the MSB (Most Significant Bit) and Value 4 the LSB (Least Significant Bit).

Knowing this we can apply the same logic we’ve used before starting from the LSB Bit (Value 4). This translates to:

 Value 1 (MSB) Bit 7 6 5 4 3 2 1 0 Value 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216 Value 2 Bit 7 6 5 4 3 2 1 0 Value 8388608 4194304 2097152 1048576 524288 262144 131072 65536 Value 3 Bit 7 6 5 4 3 2 1 0 Value 32768 16384 8192 4096 2048 1024 512 256 Value 4 (LSB) Bit 7 6 5 4 3 2 1 0 Value 128 64 32 16 8 4 2 1

To have Watt and kWh reports we need to enable bit 0 and bit 3 on Value 3.

This gives us: 2048 + 256 = 2304

So our 4 byte decimal Parameter should be set to 2304.

### Aeon Siren GEN5

The 2 byte decimal Aeon Siren GEN5 Parameter 37 can store two bytes or 16 bits as we know.

This allow us to set different sounds and adjust the volume all in one single Parameter.

Looking at the manual we can see Value 1 have 6 possible settings while Value 2 have 4. This translates to:

 Value 1 (MSB) Sound 5 Sound 4 Sound 3 Sound 2 Sound 1 Bit 4 3 2 1 0 Value 4096 2048 1024 512 256 Value 2 (LSB) Volume 3 Volume 2 Volume 1 Bit 2 1 0 Value 4 2 1

However a different logic has been used by Aeon on this Parameter which can make things a bit harder to understand. If we look at the manual we have:

• Value 1
• 0 - do not change the current Siren sound
• 1 - Siren sound 1 is selected
• 2 - Siren sound 2 is selected
• 3 - Siren sound 3 is selected
• 4 - Siren sound 4 is selected
• 5 - Siren sound 5 is selected
• Value 2
• 0 - do not change the current volume
• 1 - set the volume to 88 dB
• 2 - set the volume to 100 dB
• 3 - set the volume to 105 dB

These are the decimal values but they are applied with respect to being spread across a 2 byte value.

Because the values for sound and volume are applied as a single 2 byte parameter we need to convert the bit patterns appropriately.

It’s probably easier to understand with an example:

• Look at siren Sound 4, manual says its value is 4
• Now look at the above 8 bit value pattern - which "bit" would we check to give value of 4? The answer is bit 2
• And what value is bit 2 in the 2nd byte of a 2 byte value? Answer is 1024

If this sounds complicated, it can be :-)

Lets take a look at a second example:

• Look at siren Sound 3 with value 3
• Which "bit" would we check to give value of 3? We’d need to enable bit 0 and 1 (1 + 2)
• What's the sum of bit 0 and 1 value on a standard 8 bit value pattern? Answer is 768 (512 + 256)

Note: for a full list of the decimal values to be used with the Aeon Siren take a look at this guide

### Fibaro Swipe

Parameter 31-36 allows a user to create sequences of two or three gestures to expand the number of possible actions.

These are 2 byte decimal Parameters where each gesture takes 4 bits.

Each gesture can be identified as follow:

 Value 4 bits Gesture 0 0000 empty 1 0001 ^ 2 0010 v 3 0011 < 4 0100 >

The sequence bit pattern can be translated as:

 Value 1 (MSB) - reserved Bit 3 2 1 0 Value 32768 16384 8192 4096 Value 2 - first gesture Bit 3 2 1 0 Value 2048 1024 512 256 Value 3 - second gesture Bit 3 2 1 0 Value 128 64 32 16 Value 4 (LSB) - third gesture Bit 3 2 1 0 Value 8 4 2 1

To create a ^ (up) > (right) < (left) sequence:

• Value 1 is reserved so its value is 0
• Value 2 is "up" so we'd enable bit 0 (0001) = 256
• Value 3 is "right" so we'd enable bit 2 (0100) = 64
• Value 4 is "left" so we'd enable bit 0 and 1 (0011) = 2 + 1

If we add up all values we get 323.

### Fibaro Motion Sensor GEN5

The 2 byte decimal Fibaro Motion Sensor GEN5 Parameter 66 can store two bytes or 16 bits which allow us to set a temperature offset from -100 to 100 ºC in 0.1ºC increments.

To set a temperature offset of -2.0 ºC you’d subtract the desired absolute value (20) to the maximum value the Parameter can take (2^16).

This translates to (2^16) – 20 = 65516.

So our 2 byte decimal Parameter should be set to 65516.