CT_SETBIT

 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()

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.