[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SETBIT()
 Sets one or more bits in a number
------------------------------------------------------------------------------
 Syntax

     SETBIT(<nLONG|cHexLONG>,<nBitPos1>,
        [<nBitPos32>]) --> nNewValue

 Arguments

     <nLONG|cHexLONG>  Designates either a decimal number or hexadecimal
     number string.

     <nBitPos1> ...  <nBitPos32>  Designates which bit numbers to
     set.

 Returns

     SETBIT() sets the designated bits and returns the result.

 Description

     For example, SETBIT() allows you to set one or more bits to change a
     serial interface register.  This is in contrast to NUMOR(), where the
     bit numbers can be set and do not need to be previously converted.  The
     value 1 represents the bit with the lowest value; 32 is the bit with the
     highest value.

 Note

     .  An invalid parameter returns a result of -1.

 Example

     Set bits 1, 2, and 5 in a numeric field:

     nBitfield  :=  0
     nBitfield  :=  SETBIT(nBitfield, 1, 2, 5)   // Result:  19


See Also: NUMAND() NUMNOT() NUMOR() NUMXOR() ISBIT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson