CT_NUMAND

 NUMAND()
 Performs a 16-bit "AND" of a list of numbers
------------------------------------------------------------------------------
 Syntax

     NUMAND(<nWORD1|cHexWORD1>,<nWORD2|cHexWORD2>,
        [...<nWORDn|<cHexWORDn>]) --> nWORD-AND

 Argument

     <nWORD1|cHexWORD1>, <nWORD2|cHexWORD2>, ...<nWORDn|cHexWORDn>
     Designates either decimal or hexadecimal number strings.

 Returns

     NUMAND() joins all designated parameters with the logical "AND" and
     returns the result.

 Description

     This function makes it simple to test several bits in a number
     simultaneously.  If bits are connected in an AND configuration, you can
     mask out specific bits and the unneeded bits are reset to 0.  All the
     numbers specified as parameters are then connected with AND.

 Note

     .  An invalid parameter returns a result of -1.

 Example

     Test an interface register:

     The register contains:         00011101
     The constant in binary:        00000111
                                    ________
     The result: (5)                00000101
     nStatus  := COM_MSR()
     IF NUMAND(nStatus, 7) = 5
        ? "Bit 1 and Bit 2 are set!"
     ENDIF

See Also: NUMNOT() NUMOR() NUMXOR() SETBIT() 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.