Low-Cost Digital I/O Interface and Hardware Watchdog

The I/O interface has the following features:


RS232 Command Reference

All commands must be terminated with a carriage return character (hex 0d). Most commands expect a numerical argument which can be separated from the command by one or more spaces. A command line must not exeed 20 bytes. Commands that don't return information (all except "?", "status" and "timers") return the line "ok". On lines containing a syntax error the controller responds with "error".The controller always appends a carriage return character on its response. For communication, a fixed baud rate of 9600, no parity, 8 data bits, 1 stop bit is used.

Request the identification string. This is something like "DoubleFox I/O Rev. 1.1".

Returns the status of all input and output ports as a 8 digit string. The first 4 characters indicate the status of the output ports. The first character represents output port 3 (counted from 0). A zero means output port is off, a one means output port is on. The last 4 chararacters indicate the status of the input ports: The last character represents input port 0. A one indicates that a voltage is present at the corresponding input pins.

activate n0 n1 ...
Activates the corresponding output ports. Multiple output ports can be activated with one single command. For example, "activate 0 2" activates output 0 and 2. The spaces between the command and port numbers can be omitted. On success, the controller responds with "ok". This happens also if the output ports have already been activated.

deactivate n0 n1 ...
Switches the corresponding output ports off. Multiple output ports can be deactivated with one single command. For example, "deactivate 0 2" deactivates output 0 and 2. The spaces between the command and port numbers can be omitted. On success, the controller responds with "ok". This happens also if the output ports already were off already. On power on state, all output ports are off.

changes n
Activates or deactivates change notification. If n is 1, change notification is switched on. If n is zero, change notification is switched off. If change notification is active and the controller detects a change on the input ports, a 4 character string is imediately send representing the status of the input ports. The first character corresponds to input port 3. Input port changes that last only about 0,3 ms or shorter are rejected as noise.

arm n t1 t2
Activates timer for output port n. After time period t1 output port n is switched on and stays on for time period t2. t1 and t2 are given in tenths seconds. t1 may be a value from 1 to 4095 which corresponds to periodes from 0.1 to 409.5 seconds. t2 must be in the range of 0 to 4095. If t2 is zero, the output stays on infinitely after period t1 elapsed. This command automatically deactivates port n if it is active. On success, "ok" is returned. The time period t1 may be restarted using the "reset" command. With both commands, the interface can be used as a hardware watchdog timer.

reset n
Restarts timer interval t1 for port n (see "arm" command). This command returns "ok" if the timer of port n is active and was still within period t1. Otherwise "error" is returned indicating that the timer could not be restarted.

disarm n
Disables the timer on port n. If n is a valid port number, this function always responds with "ok". If a timer is active on port n it is deactivated, independent from whether the timer is in interval t1 or t2 (see "arm" command). The state of the port is not changed.

Returns the state of all timers as a 4 digit string. The first digit corresponds to port 3, the second digit to port 2 and so on. A zero digit means that no timer on this port is active, a one digit means that there is a timer active, independent whether it is in period t1 or t2 (see "arm" command). When timing interval t2 has elapsed on any port, the timer is automatically deactivated and therefore its state is returned as a zero, as if it has ben disabled by the "disarm" command .

Input ports

The 470 ohms resistor on the input ports of the opto couplers allows applying 5V to make the controller detect a high on the corresponding input port. For using other input voltages, this resistor has to be exchanged. The absolute maximum current of the opto coupplers photo diode is 100 mA. Normal operating current should be significantly lower.


Frank Hitzel, 2003