eth32_pulse_bit

int eth32_pulse_bit(eth32 handle, int port, int bit, int edge, int count);

Summary

This function outputs a burst of pulses on the port and bit specified. This can be useful, for example, in quickly clocking an external digital counter a specified number of times. You should ensure that the specified bit is configured as an output bit before calling this function. The ETH32 device implements the pulse functionality (as opposed to the API), which means it is performed very quickly and is efficient for network traffic.

Parameters

  • handle - The value returned by the eth32_open function.

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

  • bit - The bit number (0-7) on the specified port that should be pulsed.

  • edge - Specifies whether the pulses should be falling or rising edge. This parameter can accept either of these constants, which define a single pulse as follows:

    • PULSE_FALLING - Bit is set low, then high, for each pulse.

    • PULSE_RISING - Bit is set high, then low, for each pulse.

  • count - The number of times to pulse the bit. May be up to 255.

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

The falling edge mode would typically be used on a bit that is initially high (and likewise rising edge with low), but this is not required. If a single falling edge pulse is performed on a bit that is already low, the pulse will end up simply setting the bit high. The reverse applies to a rising edge pulse where the bit is already high.

See Also

eth32_output_bit, eth32_set_direction_bit