PCF8591 (i2c Analogue I/O Expander)

Mark.R

Member
Good evening,

As the title says really, has anyone ever used this I2C analogue input expander chip and would you use/configure it in PE6 the same you would the MCP23017 digital one that everyone has used, I did do a search but the only thing I could find were really old archived posts that are minimal.
 

Jeff Haas

Senior Member
If you're up for converting from Arduino C++, there is plenty of info on Adafruit's site:
 

hippy

Ex-Staff (retired)
The only thing I could find which mentioned its use with a PICAXE was this old archived post from back in 2006 -

https://picaxeforum.co.uk/threads/i2c-routine-for-philips-adc-dac-pcf8591.3921/#post-24212

As far as writing to it is concerned, it's pretty straight forward. You just replace the memory address byte with he control byte and go from there. It's laid out rather well in the datasheet for the PCF8591.

As far as reading goes, unless you have an 18X with firmware 8.6 and higher and the proper version of the editor (dont remember which one) your going to have to bit bang it. Older chips require an address byte for reading, newer chips dont.
It's been a while since I have done any I2C, and that's from times long ago, so I am not sure if that's correct, that standard PICAXE HI2C commands cannot be used. But bit-banging would be easy enough.

Assuming it's four channels of single-ended ADC being read, and standard HI2C commands do work, I would expect this to work but haven't tested it, don't have a PCF8591 to test with -
Code:
Symbol DEVICE_ID = %10010000 ; %1001xxx0

HI2cSetup I2CMASTER, DEVICE_ID, I2CSLOW, I2CBYTE
Do
  For b1 = 0 To 3
    HI2cOut (b1)
    HI2cIn  (b0)
    SerTxd("ADC ", #b1, " = ", #b0, CR, LF)
  Next
  SerTxd( CR, LF )
  Pause 1000
Loop
Maybe HI2cOut b1, (0).
 
Top