# Thread: Covert Hex to Bin

1. User
Join Date
23.09.2013
Posts
10

## Covert Hex to Bin

hi

Please support me how i can convert one value from Hex to Bin format , this hex value coming from PLC over Modbus Protocol,,,

another thing how i can using each binary bits individals beacuse each binary bit represents breaker status

thanks for your quick responce for my issue

regards

2. ## Re: Covert Hex to Bin

Regarding your second question:
In order to have an access to the bit of variable in zenon Logic, you just have to put a dot "." at the end of variable name and then put the number of bit, which you would like to use/check/read.
variableName.bitNo

You can find detailed information in following zenon Logic help chapter:
Programming languages - Reference guide -> Basic Operations -> Access to bits of an integer

Regards
Piotr

3. User
Join Date
23.09.2013
Posts
10

thanks

4. User
Join Date
15.12.2017
Posts
1

## Re: Covert Hex to Bin

How about the first question? Is there any way to convert a hex or integer value to a binary value using STRATON 9.1?

Regards,
Felix

5. ## Re: Covert Hex to Bin

>Is there any way to convert a hex or integer value to a binary value using STRATON 9.1?
Piotr has already answered exactly this question.

In an integer variable you can access the whole value (then decimal or hexadecimal), or bit-by-bit. For example: if an UINT (so numeric 16-bits value) variable name is Dummy, then in ST-language you can access the lowest bit of this variable using syntax Dummy.0, the next bit: Dummy.1, the highest bit: Dummy.15

6. Moderator
Join Date
06.01.2016
Posts
2

## Re: Covert Hex to Bin

Originally Posted by Felix
How about the first question? Is there any way to convert a hex or integer value to a binary value using STRATON 9.1?

Regards,
Felix

Hi Felix,

There is another solution, it is using the function block unpack8 to convert a byte to a set of 8 bits.
It can be used in combination with HIBYTE, LOBYTE that converts words to byte, and HIWORD, LOWORD, that converts dwords to words.

#### Posting Rules

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•