Online Development Notebook > Index > ODN > USBm DLL Programming > Device Commands > WriteBBit

WriteBBit


Description:

This is a USBm.dll function that writes masked values to port B. The net result of writing masked values is that only the specified bits will be written. The resulting port condition is the logic combination of the current port state ANDed with the first term and then ORed with the second. This command can affect any number of lines on the port.

 

Command Syntax: (USBm.dll)

USBm_WriteBBit(device, and_term, or_term)

The USBm_WriteBBit function syntax has these parts:

Part Description
device A zero-based index to address the appropriate USB device.
and_term Bits in and_term that are 0 force the line to be a zero. The set bits act as a "don't care". Think of the 0 positions in and_term as "turn off".
or_term Bits in or_term that are 1 force the output line high, the bits set to 0 are don't-cares. Think of the 1 positions in or_term as "turn on".

 

Remarks:

 

 

VB Declaration

Public Declare Function USBm_WriteBBit _
    Lib "USBm.dll" _
        (ByVal device As Byte, _
        ByVal and_term As Byte, _
        ByVal or_term As Byte) _
    As Integer

 

VB Example

USBm_WriteBBit 2, &H0F, &H00

This code fragment addresses port B of device 2 It sets the uppor nibble (higher 4 lines) low while allowing the lower nibble to remain unchanged.

 

C Example

-TBD-


Hardware:  U401 USB Interface    U421 USB Interface
Programming:  USBm DLL Programming    Download Files
Application Notes:  U4x1 Application Notes    Misc Applications and Information    FAQ