eth32_output_byte

int eth32_output_byte(eth32 handle, int port, int value);

Summary

This function 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 eth32_set_direction function), 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

  • handle - The value returned by the eth32_open function.

  • 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 function returns zero on success and a negative error code on failure. Please see the Error Codes section for possible error codes.

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
eth32 handle;
int result;

// .... Your code that establishes a connection here

// Set port 0 pins to be outputs
result=eth32_set_direction(handle, 0, 255);
if(result)
{
	// handle error here
}

// Write a new value for port 0
result=eth32_output_byte(handle, 0, 85);
if(result)
{
	// handle error here
}
         
See Also

eth32_input_byte, eth32_output_bit, eth32_readback, eth32_set_direction