
OLIMEX© 2015
MOD-IO2 user's manual
- Reading the status of the relays (available since MOD-IO2's firmware revision 3.02):
i2cset –y 2 0x21 0x43
and then the read command
i2cget –y 2 0x21
,where
i2cset – command for sending data;
-y
– to skip the y/n confirmation prompt;
2
– I2C number (usually 0, 1, or 2);
0x21 – board address (0x21 should be used for writing);
0x43 – read relay operations (as seen in the firmware README.txt);
Expected results: 0x00 – meaning both relays are off; 0x03 – should be interpreted as binary 011,
e.g. both relays are on; etc.
- Reading analog inputs/outputs:
i2cset –y 2 0x21 0x10
and then the read command
i2cget –y 2 0x21
,where
0x10 – the first analog IO;
The big thing here is that to read you actually have to write (“that you would read”). Read is a
combination of i2cset and i2cget!
Expected results: on the terminal you would receive random and changing number or 0x00 or 0x08
or 0xFF whether you have the GPIO floating or set to 0V or set to 3.3V.
- Setting all analog IOs at high level:
i2cset –y 2 0x21 0x01 0x01
,where
0x21 – the I2C address of the MOD-IO2
0x01 – according to the README.txt is SET_TRIS is used to define port directions;
0x01 – the high level (for low level use 0x00).
Page 12 of 28