OK, a bit more explanation.
I DO have the DEFINE I2C_SLOW 1 in my header,
Also,
The logical OR is to set the actual device address.
The "identifier" address of the PCF 8591 is %1001xxxy,
where "xxx" = the sub-address (as set by the 3 hardware
addressing pins), and "y" is the Read/Write bit. I have to shift
the sub-address (or hardware address) left with the << 1
to align it properly.
So, with my ORing statement, I'm actually sending
%10010000
(the chip has all 3 hardware address pins grounded)
Then I'm sending $44, which is supposed to be the control byte,
Then a data byte of "0", to tell it to start at channel "0"
The datasheet says $44 is the command to put it in the "auto-
increment" mode with "internal oscillator". After that, all you are supposed to have to do is read the chip.
A READ is supposed to give me all 4 channels at once.
I2CREAD PORTC.4,PORTC.5,DevAddr,[PSByte1,PSByte2,PSByte3,PSByte4]
The chip doesn't care what I call the bytes.
If any of this isn't correct, please tell me. Maybe that will help me
solve my problem.
Bookmarks