Data Acquisition Toolbox    

Reading Digital Values

You can read values from one or more digital I/O lines with the getvalue function. getvalue requires the digital I/O object as an input argument. You can optionally specify an output argument, which represents the returned values as a binary vector. Binary vectors are described in Writing Digital Values.

For example, suppose you create the digital I/O object dio and add eight input lines to it from port 0.

To read the current value of all the lines contained by dio and return the result to out

To read the current values of the first four lines contained by dio and return the result to out

You can convert a binvec to a decimal value with the binvec2dec function. For example, to convert the binary vector lineval to a decimal value

Rules for Reading Digital Values

Reading values from digital I/O lines follows these rules:


 Writing and Reading Digital I/O Line Values Example: Writing and Reading Digital Values