<< mdaqDIOFunc Data acquisition mdaqDIOWrite >>

MicroDAQ Support Package for Matlab/Simulink >> MicroDAQ Support Package for Matlab/Simulink > Data acquisition > mdaqDIORead


Reads DIO channel

Calling Sequence

state = mdaqDIORead(dio)


This function reads DIO channel input state.

Function will return an error if DIO channel is configured as input or has alternative function (ENC1, ENC2, PWM1, PWM2, PWM3, UART). Selected DIO channel should be configured as a DIO function, if ENC1, ENC2, PWM1, PWM2, PWM3 or UART function is enabled on selected DIO channel, mdaqDIOFunc function should be used to disable it.

Input arguments

Output arguments


% disable Encoder 1 function
mdaqDIOFunc(1, false);
% read DIO1 state
sprintf('DIO 1 state: %d\n', mdaqDIORead(1))
% enable Encoder 1 function
mdaqDIOFunc(1, true);

See Also

Report an issue
<< mdaqDIOFunc Data acquisition mdaqDIOWrite >>