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

DirectionB


Description:

This is a USBm.dll function that sets the i⁄o direction of port B.

 

Command Syntax: (USBm.dll)

USBm_DirectionB(device, dir0, dir1)

The USBm_DirectionB function syntax has these parts:

Part Description
device A zero-based index to address the appropriate USB device.
dir0 Port direction.
dir1 Port direction.

 

Remarks:

The individual pins of the ports can be set to input, or output. Input is set when both bits associated with a particular line are set to 0. There are different types of outputs available for the board, but generally setting both of the direction bits to 1 will suffice.

To set all pins in the port to input, set dir0 = 00h and dir1 = 00h. To set the highest port pin to output set the highest bit in both registers, dir0 = 80h and dir1 = 80h.

 

VB Declaration

Public Declare Function USBm_DirectionB _
    Lib "USBm.dll" _
        (ByVal device As Byte, _
        ByVal dir0 As Byte, _
        ByVal dir1 As Byte) _
    As Integer

 

VB Example

USBm_DirectionB 4, &HFF, &HFF

This code fragment sets port B of device 4 to output.

 

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