Online Development Notebook > Index > Programming Overview > Device Commands > ResetBit

ResetBit - Set a single one of the port bits to 0⁄low


Description:

This is a function that resets a single bit⁄line low.

Command Syntax: (USBm.dll)

USBm_ResetBit( device, bit )

The USBm_ResetBit function syntax has these parts:

Part Description
device A zero-based index to address the appropriate USB device.
bit The bit that will be affected.

Remarks:

Bit⁄Line Selection

Byte Value Result   Byte Value Result
00h Affect A.0 (Port A, pin 0)   08h Affect B.0
01h Affect A.1   09h Affect B.1
02h Affect A.2   0Ah Affect B.2
03h Affect A.3   0Bh Affect B.3
04h Affect A.4   0Ch Affect B.4
05h Affect A.5   0Dh Affect B.5
06h Affect A.6   0Eh Affect B.6
07h Affect A.7   0Fh Affect B.7

 


VB Declaration

Public Declare Function USBm_ResetBit _
    Lib "USBm.dll" _
        (ByVal device As Byte, _
        ByVal bit As Byte) _
    As Integer

VB Example

USBm_ResetBit 0, 0

This code fragment clears bit A.0 of device 0.


C Prototype

int USBm_ResetBit( unsigned char device, unsigned char bit );

 

C Example

 


RobotBASIC

usbm_ResetBit(ne_DeviceNumber,ne_PinNumber)

Returns true if successful, false otherwise. This function makes high⁄low a particula pin on any of the ports. The pin number is 0 for A0 1 for A1...7 for A7...8 for B0, ....15 for B7.


Raw Command  Format:

Byte Number Description
0 08h: ResetBitCmd
1 Data - This is the line to reset: D0 - D15
2 <not used>
3 <not used>
4 <not used>
5 <not used>
6 <not used>
7 <not used>

Raw Command  Format Details:

Byte 0 contains the command. Byte 1 contains the line to reset. Byte 2 through byte 7 are unused.

Bit⁄Line Selection

Byte Value Result   Byte Value Result
00h Affect A.0   08h Affect B.0
01h Affect A.1   09h Affect B.1
02h Affect A.2   0Ah Affect B.2
03h Affect A.3   0Bh Affect B.3
04h Affect A.4   0Ch Affect B.4
05h Affect A.5   0Dh Affect B.5
06h Affect A.6   0Eh Affect B.6
07h Affect A.7   0Fh Affect B.7

Raw Command Response Format:

Byte Number Description
0 08h: ResetBitCmd
1 <not used>
2 <not used>
3 <not used>
4 <not used>
5 <not used>
6 <not used>
7 <not used>

Raw Command Response Format Details:

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

Raw Command Example Usage:

The command 08-01-00-00-00-00-00-00 will set lines A.1 low, assuming it is configured as an output.


Hardware:  U401 USB Interface    U421 USB Interface   U451 USB Interface

Programming:  USBm DLL Programming    Download Files

Application Notes:  U4x1 Application Notes    Misc Applications and Information    FAQ

While every effort has been made to make sure that the information posted on this site is correct, the author can not be held liable for any damages whatsoever for losses as a result of the application of this information. Use this information at your own risk.

USBmicro can design your custom and semi-custom USB product. Email about USB design can be directed to " Robert " at usbmicro.com.

Copyright © USBmicro, L.L.C., 2002-2010

Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 61 of 126)

This page is created with TreePad