OLIMEX© 2020
MOD-IO user's manual
/* To convert digital reading to voltage use this */
voltage = (analog*3.3)/1023;
2.7.4 Changing the I2C address of a board
Sets new slave address to the board. The board ships with default 7bit address 0×58 that can be changed
to any other 7bit value in order for the host to interface more than 1 device connected on the bus at the
same time. Change is stored in EEPROM and thus is permanent between power cycles. Changing the
address requires the following command format:
************************************
S aaaaaaaW cccccccc 0ddddddd P
************************************
,where
S – start condition
aaaaaaa – slave address of the board (the default or the old address of the board)
W – write mode, should be 0
cccccccc – command code, should be 0xF0
ddddddd – new 7bit address to update
P – Stop condition
NB!! To protect the device from accidental address updates the user should hold the on-board button
pressed (not the RESET button!) while issuing the command. Successful update is indicated with the on-
board status LED being contently lit for 2-3 seconds. Address is immediately updated so the board will
not respond to its old address any more.
IMPORTANT: The default address of the board could be restored if the on-board button is held pressed at
power up for more than 4 seconds. This situation is indicated by the on-board LED blinking fast for the
timeout period. When the fast blinking ends default address is restored.
Example:
Change address to 0×22 in pseudo code:
i2cStart();
//Send start condition
i2cSend(0xb0);
//This is 0×58 shifted to left one time and added 0 as W
i2cSend(0xF0);
//Command to change address
i2cSend(0x22);
//New address
i2cClose();
//Send stop condition
Page 13 of 30