OutputByte Method

Public Sub OutputByte(ByVal port As Long, ByVal value As Long)

Summary

This method writes a new output value to one of the digital I/O ports on the device. When the port is configured as an output port (using the SetDirection Method), each bit of the output value determines the voltage (0 or 5V) of the corresponding bit of the port. When the port is configured as an input port, any 1-bits in the output value enables a weak pullup for that bit of the port.

Parameters

  • port - The port number to write to (0-5).

  • value - The new value for the port. This may be 0-255 for ports 0-3 and 0-1 for the single-bit ports 4 and 5.

Return Value

This method does not return a value.

Remarks

Port 3 shares its pins with the analog channels. When the ADC is enabled, all pins of port 3 are forced into input mode and the output value is set to zero. Port 3's output value cannot be modified while the ADC is enabled.

Example
Private Sub example()
    
    ' Set up error handling for this routine
    On Error GoTo myerror
    
    Set dev = New Eth32
    
    ' .... Your code that establishes a connection here


    ' Set port 0 pins to be outputs
    dev.SetDirection 0, 255
    
    ' Write a new value for port 0
    dev.OutputByte 0, 85

    
    Exit Sub
myerror:
    MsgBox "ETH32 error: " & dev.ErrorString(Err.Number)
End Sub
        
See Also

InputByte Method, OutputBit Method, Readback Method, SetDirection Method