Showing results 1 to 6 of 6

Thread: Covert Hex to Bin

  1. #1
    Join Date
    23.09.2013
    Posts
    10

    Default 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. #2
    Join Date
    20.07.2012
    Posts
    6

    Default Re: Covert Hex to Bin

    Hi ziadnajjar,

    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. #3
    Join Date
    23.09.2013
    Posts
    10

    Default Re: Covert Hex to Bin

    thanks

  4. #4
    Join Date
    15.12.2017
    Posts
    1

    Default 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. #5
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    799

    Default 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. #6
    Join Date
    06.01.2016
    Posts
    2

    Default Re: Covert Hex to Bin

    Quote Originally Posted by Felix View Post
    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.


Similar Threads

  1. Replies: 1
    Last Post: 24th November 2010, 14:03
  2. Problem with Alarm.bin
    By cyrilfeasy in forum zenon Supervisor
    Replies: 2
    Last Post: 2nd December 2009, 23:02
  3. Dynamic limittext as Hex
    By kicker in forum zenon Supervisor
    Replies: 1
    Last Post: 14th August 2009, 12:20

Posting Rules

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