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

WriteABit


Description:

This is a USBm.dll function that writes masked values to port A. 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_WriteABit(device, and_term, or_term)

The USBm_WriteABit 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_WriteABit _
    Lib "USBm.dll" _
        (ByVal device As Byte, _
        ByVal and_term As Byte, _
        ByVal or_term As Byte) _
    As Integer

 

VB Example

frmStatus.lstDevices.AddItem " "
USBm_WriteABit 5, &HFF, &H0F

This code fragment addresses port A of device 5 It sets the lower nibble (lower 4 lines) high. The AND term can be FFh (all don't-cares), the OR term would then be 0Fh.

 

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