Showing results 1 to 2 of 2

Thread: Difference Between testBit/setBit and variable.bitNumber

  1. #1
    Join Date

    Frage Difference Between testBit/setBit and variable.bitNumber

    Hi ,
    Suppose that i have a word variable like xWord (which is imported from OPC server) and i want to read or set some of its bits.(in following example, xbit is an internal zenon variable which is visible in Scada Logic) What's the difference between following approaches ? :

    1- xbit1  :=testBit(xWord ,1);  //(For reading second bit or bit number 1 )
        xWord := setBit(xWord,2, xbit2); //(For setting third bit or bit number 2 of xWord. This should change value of original xWord variable on the OPC and PLC)

        or :
    2-xbit1 := xWord.1 ;
       xWord.2 = xbit2 ;

    Thank you!

  2. #2
    Join Date
    Salzburg, AT
    Best Answer

    Default Re: Difference Between testBit/setBit and variable.bitNumber

    In case of your code - calling the FBs *Bit with a constant in the input BIT - there is no difference.

    The FBs *Bit are useful in the scenario when BIT input is a dynamical value (in a variable), and not a fix constant.

Similar Threads

  1. 1. Modify BitAddr of variable, 2. edit SubItems of variable
    By professor_hubert_farnsworth in forum VSTA
    Replies: 3
    Last Post: 18th January 2017, 09:46
  2. Difference bewteen stratonng variables
    By DavidMarek in forum Engineering Studio Logic & Logic Service (former zenon Logic Workbench & Runtime)
    Replies: 2
    Last Post: 1st March 2016, 13:05
  3. Some variable's properties to be filled with the archived value of a variable in a report sheet
    By hamid in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 2nd August 2011, 10:21

Tags for this Thread

Posting Rules

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