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