Online Development Notebook > Index > ODN > Raw Device Programming > 0A - DirectionBCmd

Command #0A - DirectionBCmd


Description:

Set the i⁄o direction of port B.

Command Format:

Byte Number Description
0 0Ah: DirectionBCmd
1 direction0 The most significant bit of the byte value is associated with B.7
2 direction1 The most significant bit of the byte value is associated with B.7
3 <not used>
4 <not used>
5 <not used>
6 <not used>
7 <not used>

Command Format Details:

Byte 0 contains the command. Byte 1 is written to the direction0 control register, byte 2 is written to the direction1 control register appropriate for this port. Byte 3 through byte 7 are unused.

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.

Response Format:

Byte Number Description
0 0Ah: DirectionBCmd
1 <not used>
2 <not used>
3 <not used>
4 <not used>
5 <not used>
6 <not used>
7 <not used>

Response Format Details:

Byte 0 contains the command. Byte 1 through byte 7 are unused.

Example Usage:

The command 0A-00-00-00-00-00-00-00 will set the port to all input, the command 0A-FF-FF-00-00-00-00-00 will set the port to all output. To have the upper nibble be input and the lower nibble output, use the command 0A-0F-0F-00-00-00-00-00.


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