You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
\section{Digital Input}
|
|
|
|
The digital input unit is the input counterpart of the digital output unit.
|
|
|
|
In addition to reading the immediate digital levels of the selected pins, this unit can generate asynchronous events on a pin change. The state of the entire input port, together with a microsecond timestamp (as is the case for all asynchronous events), is reported to the host either on a rising, falling, or any pin change.
|
|
|
|
The pin change event can be configured independently for each pin. In order to receive a pin change event, we must arme the pin first; it can be armed for a single event, or it may be re-armed automatically with a hold-off time. It's further possible to automatically arm selected pin triggers on start-up.
|
|
|
|
|
|
\subsection{Digital Input Configuration}
|
|
|
|
\begin{inicode}
|
|
[DI:in@2]
|
|
# Port name
|
|
port=A
|
|
# Pins (comma separated, supports ranges)
|
|
pins=0
|
|
# Pins with pull-up
|
|
pull-up=
|
|
# Pins with pull-down
|
|
pull-down=
|
|
|
|
# Trigger pins activated by rising/falling edge
|
|
trig-rise=
|
|
trig-fall=
|
|
# Trigger pins auto-armed by default
|
|
auto-trigger=
|
|
# Triggers hold-off time (ms)
|
|
hold-off=100
|
|
\end{inicode}
|
|
|
|
\subsection{Digital Input Events}
|
|
|
|
\begin{cmdlist}
|
|
|
|
0 & \cname{PIN\_CHANGE}
|
|
A pin change event. The payload includes a snapshot of all configured pins captured immediately after the change was registered.
|
|
& \begin{cmdpld}
|
|
\cfield{u16} changed pins
|
|
\cfield{u16} port snapshot
|
|
\end{cmdpld}
|
|
|
|
\end{cmdlist}
|
|
|
|
\subsection{Digital Input Commands}
|
|
|
|
\begin{cmdlist}
|
|
0 & \cname{READ} Read the pins
|
|
& \begin{cmdresp}
|
|
\cfield{u16} pin states
|
|
\end{cmdresp} \\
|
|
|
|
1 & \cname{ARM\_SINGLE} Arm for a single event
|
|
& \begin{cmdreq}
|
|
\cfield{u16} pins to arm
|
|
\end{cmdreq} \\
|
|
|
|
2 & \cname{ARM\_AUTO} Arm with automatic re-arming after each event
|
|
& \begin{cmdreq}
|
|
\cfield{u16} pins to arm
|
|
\end{cmdreq} \\
|
|
|
|
3 & \cname{DISARM} Dis-arm selected pins
|
|
& \begin{cmdreq}
|
|
\cfield{u16} pins to dis-arm
|
|
\end{cmdreq}
|
|
\end{cmdlist}
|
|
|