Devices/Modules supported by the I2C commands of the PICAXE X-parts (i2cslave, readi2c, writei2c)


Introduction

On the picaxe forum there has been some discussion about the usability of the PICAXE I2C commands for the various I2C components available, with claims ranging from almost full support, to only EEPROM support. Goal of this section is to arrive at a thoroughly checked list of devices able/unable to support the high-level I2C commands. The table below lists the devices of which is is known (i.e. tested and confirmed by PICAXE users) that they can be (or otherwise definitely cannot be) addressed directly through the PICAXEs I2C commands (i2cslave, readi2c, writei2c). Please inform me (email address at the end of this page) if you have information (based on practice) on other components/modules not mentioned here, or have information that updates the info presented here. Note that only the X-parts (18X, 28X and 40X) support the PICAXE I2C commands. In case the I2C device is not supported information on emulating routines is included whenever possible (notably P.H. Andersons site, although many solutions he presents may work well with the PICAXE I2C commands, see also the table below).


Developer's statement

"Technical" (i.e. the developer of the PICAXE chips) has made the following statement:

" *Any* i2c device can be written to via the writei2c command as long as it does not require a *single* byte of data. Devices requiring a single byte cannot be currently written to with this command, but we are looking at modifying the firmware to accept this. Devices needing a single byte write can be 'bit-banged' instead.

If the protocol of a device needing two bytes is:

--- write bytea, byteb

simply use the command format:

--- writei2c bytea,(byteb)

Although this format is nomally address, data for eeprom devices, the i2c protocol simply outputs the two bytes consequatively anyway.

The readi2c command is not quite so straight forward. It actually actions as a (write-address then read-data). Therefore readi2c 1,(b1) actions as:

--- write one byte (value 1)

--- read one byte (into variable b1)

Future firmware versions will also accept a read without the initial address write. However any version chip can be used with bit-bang type routines. "


PICAXE I2C-compliant devices overview

Part number

Description

Proven direct PICAXE i2c support?

Notes

DS1307 Real-Time Clock chip, Battery backup(Dallas Semiconductor) Yes See Rev-Ed's i2c tutorial for command & hardware use
DS1050 5-Bit PWM Controller (Dallas Semiconductor) No Non-standard i2c protocol (address absent): use P.H.Anderson's DS1050 routines to simulate the particular protocol
DS1807 Digital Potentiometer (Dallas Semiconductor) Yes Address absent for writei2c, but use the following command sequence (replacing the address with the command):

i2cslave slave_address, i2cslow, i2cbyte

writei2c command_byte, (data_byte)

24LCxxx (various parts) Serial EEPROMs Yes See Rev-Ed's i2c tutorial for command & hardware use
PCF8574 PCF8574A 8-bit I/O Expander (Philips Semiconductors) Yes  
MCP23016 16-bit I/O Expander (Microchip) Yes  
AXE033 Serial LCD Module Yes See Rev-Ed's AXE033 datasheet for command & hardware use
SPE030 Speech Module Yes See Rev-Ed's i2c tutorial for command & hardware use
CMPS03 Compass Module Yes See Devantech's Compass-PICAXE datasheet for command & hardware use
SRF08 Sonar Module Yes See Devantech's Sonar-PICAXE datasheet for command & hardware use
DS1337 Real-Time Clock chip, Programmable Alarm ??? Please contact if you have practical experience using this device with PICAXE's i2c commands
DS1624 Digital Thermometer & Memory ??? Please contact if you have practical experience using this device with PICAXE's i2c commands
DS1678 Real-Time Event Recorder ??? Please contact if you have practical experience using this device with PICAXE's i2c commands
MAX517/518 519/520 DAC Converter ??? Please contact if you have practical experience using this device with PICAXE's i2c commands
??? ??? ??? Please contact if you have practical experience using a particular device or module with PICAXE's i2c commands

 

Contact me