Page 2 of 2 FirstFirst 1 2
Showing results 11 to 13 of 13

Thread: how to convert the content of a variable in decimal into an hexadecimal value

  1. #11
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    986

    Default Re: how to convert the content of a variable in decimal into an hexadecimal value

    sample code to map a DINT variable value to single bits as 31 BOOL variables (in ST language):

    varBOOL01 := varDINT.0; // lowest bit
    varBOOL02 := varDINT.1;
    ...
    varBOOL31 := varDINT.30; // last value bit; note: the next, highest bit - 31 - is the sign bit (negative/positive)


    The bit 32 is omitted, the DINT can be evaluated like this only for positive values. To evaluate 32 bits i would propose the use of UDINT, not DINT.
    If you need to transfer the timestamps too, then you can use functions VSIGetDate and VSIGetTime (from varDINT) and then VSISetDate and VSISetTIme (to varBOOL); functions are are documented in Help.
    Last edited by ursulak : 15th March 2021 at 09:55 Reason: completed

  2. #12
    Join Date
    10.12.2007
    Posts
    260

    Böse AW: Re: how to convert the content of a variable in decimal into an hexadecimal value

    Quote Originally Posted by ursulak View Post
    @mst: please do not advise people to use a solution with simulator driver: it potentially results in licensing issues and it anyway not transfers the timestamp of variable value.  

    Aha, and that's the reason you keep deleting my posts? I think my tip would be exactly what he is looking for.
    And what do you mean with "...it potentially results in licensing issues..." ?
    The driver is still available. Even the Copa-Data project wizard still creates this driver.

    You keep telling him to use logic although he explicit asks for a different solution ("Is there a way to do it without Logic?")

  3. #13
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    986

    Default Re: how to convert the content of a variable in decimal into an hexadecimal value

    the simulator driver is and will be there, don't worry.

    the only solution i can recommend are:
    - program PLC to deliver single bits, not an DINT. Yes, i know that this means consumption of more variables (licensed tags) in zenon, but this makes the project simpler and easier to maintenance. 
    - code in API; potential risk by mistakes in programming: API can block zenon Runtime.
    - code in zenon Logic.

    My experience shows that if someone says "not in Logic" then only because the person does not know the Logic yet. Thus, my answer is to deliver more info how the user can solve it in Logic, till the user understand that it is not soooooo complicated :-)

Similar Threads

  1. Styles content is not visible in Zenon 7.60
    By rahulindore05 in forum zenon Service Engine Supervisor
    Replies: 2
    Last Post: 12th May 2018, 08:14
  2. Comma as separator for decimal value
    By altera in forum zenon Service Engine Supervisor
    Replies: 4
    Last Post: 23rd August 2016, 10:17
  3. Convert variable for Process Gateway
    By diemon in forum Drivers
    Replies: 5
    Last Post: 3rd March 2015, 09:07
  4. Dynamic limit texts with hexadecimal value
    By lew in forum zenon Service Engine Supervisor
    Replies: 1
    Last Post: 9th January 2012, 00:41
  5. convert anything to bit
    By brandt in forum Engineering Studio Logic & Logic Service (former zenon Logic Workbench & Runtime)
    Replies: 0
    Last Post: 7th February 2008, 13:04

Posting Rules

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