PCF8574 i/o expander

stocky6409

Senior Member
Just reading a few posts about various i2c chips and thought I would share what I have found.

There seems to be some chips that dont seem to work well with the picaxe i2c commands and others that do.

I have been using the PCF8574 with good success and it has me puzzled why it is said the same wont work for the DS1050 for example.

Users claim it is due to the 2 byte vs 3 byte thing, but as far as I can see, the PCF8574 is only a 2 byte device so why wont it work for the DS1050

example snippett (18x):
<code><pre><font size=2 face='Courier'>
PCF8574_read:
i2cslave %01001111, i2cslow, i2cbyte
readi2c (b1)

PCF8574_write:
i2cslave %01001110, i2cslow, i2cbyte
b1 = b1 * 16
b1 = b1 + %00001111
writei2c (b1)
pulsout 0,500
</font></pre></code>

Now that looks like it would be the same as talkign to the DS1050 - or have i missed something.

This code WORKS - its part of a program that has 4 switches &amp; 4 leds on the PCF8574 - it reads the switches, sets the leds and then &quot;b1&quot; valued is used futher on in the program.

I need to be able to generate 4 or 8 different PWM outputs all independantly of each other, so sort of need to get the DS1050 or similar to work.

PS I havent even got a DS1050 yet to play with - this is all from posts I have read about them NOT working - maybe the firmware has changed now and this is no longer a problem????

Cheers

Stocky
 

stocky6409

Senior Member
From the DS1050 datasheet - this should work
A2,A1 &amp; A0 all pulled low for this example.

<code><pre><font size=2 face='Courier'>
i2cslave %01010000, i2cslow, i2cbyte 'slave address, device select, WRITE mode

let b1 = %00011111 'set a value

writei2c (b1) 'write value to DS1050
</font></pre></code>

That should set output of PWM to 96.88% duty cycle.

I cant see why that is not supposed to work when it works for the PCF8574

anyone?

 
Top