Showing results 1 to 10 of 13

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Join Date
    01.07.2008
    Location
    Salzburg, AT
    Posts
    1,030

    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

Similar Threads

  1. Convert variable for Process Gateway
    By diemon in forum Drivers
    Replies: 6
    Last Post: 22nd June 2021, 15:48
  2. 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
  3. Comma as separator for decimal value
    By altera in forum zenon Service Engine Supervisor
    Replies: 4
    Last Post: 23rd August 2016, 10:17
  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
  •