USBmicro

Your source for USB electrical device interface products.

  • Home
  • Services
    • Design
    • Contact USBmicro
  • Where to buy…
You are here: Home / Documentation / Device Commands / Write1WireBit

Write1WireBit

Write a bit to a 1-wire bus⁄device


VERSION 1.46+ of the firmware, VERSION 58+ of the DLL

Description:

This is a function to send a 1-wire (MicroLAN) bit write on the previously selected port pin.

Command Syntax: (USBm.dll)

USBm_Write1WireBit( device, data )

The USBm_Write1WireBit function syntax has these parts:

Part Description
device A zero-based index to address the appropriate USB device.
data Bit to write to the bus (00h or 01h).

Remarks:

This command does not set the port direction pins or select the pin to use as the 1-wire bus – it is the Reset1Wire command that does this.


VB Declaration

Public Declare Function USBm_Write1WireBit _
    Lib “USBm.dll” _
        (ByVal device As Byte, _
               ByVal data As Byte)_
  As Integer

VB Example

USBm_Write1WireBit 3, 1

This code fragment addresses U4x1 device #3 and writes the bit value of 1 on the 1-wire bus (line to use previously selected by the Reset1Wire command).


C Prototype

int USBm_Write1WireBit ( unsigned char device, unsigned char data );

C Example

USBm_Write1WireBit ( 3, 1 );

This code fragment addresses U4x1 device #3 and writes the bit value of 1 on the 1-wire bus (line to use previously selected by the Reset1Wire command).


RobotBASIC

usbm_Write1WireBit(ne_DeviceNumber,ne_BitValue)

Returns true if successful, false otherwise. Writes a 0 or 1 to the 1wire device.


Raw Command  Format:

Byte Number Description
0 1Eh: Write1WireCmd
1 Data – Byte⁄bit to write.
2 Byte⁄bit – 0 = write byte, 1 = write bit. Bit feature for VERSION 1.30+ of the firmware
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 data to write to the previously selected port line. the data is either a byte or a bit, depending on byte 2.

Byte 2 selects writing either a byte or a bit.

This command does not set the port direction pins or select the pin to use as the 1-wire bus – it is the Reset1Wire command that does this.

Raw Command Response Format:

Byte Number Description
0 1Eh: Write1WireCmd
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.

Documentation

Open all | Close all