PDA

View Full Version : PCF8574 problem



Rudy.W
01-08-2008, 09:39 PM
·· I am using a PCF 8574 with the propeller and Burroughs I2C Object.
· ·I am using only bits 1, 2 and 3· and the following simplified code:

·· Repeat
····· N :=$F9
····· waitcnt(50_000_000+cnt)
··· · I2CObject.writeLocation($46,$00,N,8,8)
····· Output : 11111001·· So far so good.

····· However, when i connect led's to the other outputs they flash with· the·speed of the loop.

····· so the leds on·:
···· ·Outputs : 11111010·· and··· 11111011·· both flash· but they don't get a command to do so.

····· Anybody an idea??····

···· Rudy_W
·····

Post Edited (Rudy.W) : 1/8/2008 3:03:26 PM GMT

Mike Green
01-08-2008, 10:05 PM
I think it's because you're using writeLocation which is intended for use with EEPROMs and other devices that require an address. Essentially, this call sends a byte of address followed by a byte of data. In your case, the PCF8574 is interpreting the address as data and briefly setting the I/O pins to zeros (from your furnished address) before setting them to the desired value. Try using an address of N instead of $0 and you should see the flash go away.

To really do what you want, you'll need to modify the Burroughs routines so they don't send an address byte if it's not needed.

By the way, please include a subject when you start a thread. You can go back and add one to your initial message by clicking on the pencil icon in the right upper corner of your initial message.

Post Edited (Mike Green) : 1/8/2008 3:10:59 PM GMT

Rudy.W
01-08-2008, 10:11 PM
Thanks Mike, problem solved. ( and patient still alive!!)

Rudy ( from the Netherlands)

Rayman
01-08-2008, 10:40 PM
You might want to look at my PCF8574 code here:
http://www.rayslogic.com/propeller/Programming/i2c/i2c.htm