Shop OBEX P1 Docs P2 Docs Learn Events
I2C addressing — Parallax Forums

I2C addressing

Rudy.WRudy.W Posts: 10
edited 2007-11-19 19:40 in Propeller 1
· I have spent a lot of time now to get my PCF 8591 readout working.

·The problem is that I can receive data but only from channel 1, despite the fact that i use the proper··
·addressing. (At least I think I do)

· Here is the code i use for the test program:


··· i2cAddress := $9F
··· i2cObject.Start
··· i2cObject.init(29,28)

···repeat

··· ·ackbit := i2cObject.devicePresent(i2cAddress)

··········Print_string(num.ihex(i2cAddress,2))
········· Print_string(string(" "))
············ if ackbit==true
·············· Print_string(string(" ACK " ))···························· ' Up to here no problem
············ else
············· Print_string(string(" NAK " ))·····
·············
········· I2CObject.i2cWrite($00,8)···································· '$00 used for channel 1·············
········· I2CObject.Stop···················································

··········Print_string(string("· Counts reading :"))

········ ·repeat 3
·········· counts := I2CObject.readLocation(i2cAddress,$00,8,8)······ ' Any figure used for channel selection
···········Print_string(num.dec(counts))······································· ' gives results from Ch. 1
···········print ($0D)

···········Can anyone help???··

Comments

Sign In or Register to comment.