InputSuccessive(int port, int maxcount, out int status)
This method instructs the ETH32 device to read the specified port multiple times in succession until two consecutive reads yield the same result. This method is useful for situations where a multi-bit value is being read, for example, the output of a digital counter chip. When reading such a value, it is always possible to read the value during a transition state as bits are changing and an invalid value is represented. By requiring that two successive reads match, any invalid transition values are automatically ignored. The device continues to read the port until one of the following conditions is met:
Two successive (in other words, back to back) reads give the same port value. This value is returned.
The port was read the maximum number of times specified in the command without a match occurring.
This functionality is implemented directly within the ETH32 device (as opposed to the API), making it very fast and efficient with network traffic.
port - Specifies the port number (0-3) to read.
max - The maximum number of times to read the port (2-255).
status - Output parameter which will receive the number of times the port had to be read to get a successive match. If no match was ever seen, this will be zero.
This method returns an integer. The return value is the last value read from the port, regardless of whether or not two successive reads ever matched.
Eth32 dev = new Eth32(); int portval; int status; try { // .... Your code that establishes a connection here // Read the value of an 8-bit counter on port 0, limit to 20 reads portval=dev.InputSuccessive(0, 20, status); if(status==0) { // Never saw the same value twice in a row } else { // The port value is in the portval variable } } catch (Eth32Exception e) { // Handle Eth32 errors here }