OLIMEX© 2020
MOD-IO user's manual
2.7 Default firmware description
The demo is built-in each MOD-IO board. The source code might be found in the software section at the
product page at our web site. Direct link to the board's web-page:
https://www.olimex.com/Products/Modules/IO/MOD-IO/resources/MOD-IO.pdf
Direct link to the latest firmware:
https://www.olimex.com/Products/Modules/IO/MOD-IO/resources/MOD-IO(I2C-Slave)_v1.02.zip
The archive with the sources contains a prebuilt binary which also might be used to restore the initial
functionality. The project was compiled with AVR studio 4 and WinAVR compiler (available at
sourceforge.net).
The demo requires an established hardware I2C connection between the module and a host board. You
would need to send and receive parameters to the slave device to be able to communicate with the
following peripherals on the board:
- Digital outputs (relays): OUT1, OUT2, OUT3, OUT4 – signals: O1, O2, O3, O4.
- Digital inputs (optocouplers): IN1, IN2, IN3, IN4 – signals: I1, I2, I3, I4.
- Analogue inputs: AIN-1-2, AIN-1-3, AIN-2-1, AIN-2-2 – signals AN1, AN2, AN3, AN4.
There is nothing specific about the I2C protocol. Default address of the slave is 0b1011000 (0×58). When
addressed, the device acknowledges reception with an ACK flag set to 0 to indicate its presence. After
connection is established you can use additional commands, detailed below.
2.7.1 Setting relays
Set states of the digital outputs on the board. The board features four relay outputs named OUT1, OUT2,
OUT3 and OUT4 that can be set together with one command. The command should have the following 3
byte format:
************************************
S aaaaaaaW cccccccc 0000dddd P
************************************
,where
S – start condition
aaaaaaa – slave address of the board
W – write mode, should be 0
cccccccc – command code, should be 0×10
dddd – bitmap of the output states, i.e. bit0 corresponds to REL1, bit1 to REL2 and so on. '1'
switches the relay ON, '0' switches to OFF state.
P – Stop condition
Example:
To set REL1 and REL3 in pseudo code:
Page 10 of 30