I am starting to play with I2C and the 8574 I/O expander chip,
and I am running into some of those "I don't think I understand
the manual" types of problems.
I think I grok the cases where the chip is used as either 8 bits
of input or 8 bits of output, but I am clueless about section 7.3,
where it talks about using some pins as inputs at the same time that
other pins are used as outputs. The reference to Figure 15 isn't
helping. It sounds like the chip is mainly intended to be used as an
"all inputs" or "all outputs" device, but it has some voodoo that
can make it pretend to do mixed I/O if you line up various planets...
The other bit of confusion has to do with the "how are i2C slaves
intended to be used" department. The timing diagrams imply that
you can read a slave's data by either
In the second case, I'm assuming that since the 8574 only has a
single 8-bit chunk of data to read, it simply resends the current
(possibly changing) states as the READs are processed. Or (and
thus my confusion), is the multi-read case only for devices that
have more than one byte of data to read?
Obviously, I'm missing something basic here - can anyone share a
clue or two to help?
> I am starting to play with I2C and the 8574 I/O expander chip,
> and I am running into some of those "I don't think I understand
> the manual" types of problems.
>
> Manual: http://www-us.semiconductors.philips.com/pip/PCF8574.html
>
> I think I grok the cases where the chip is used as either 8 bits
> of input or 8 bits of output, but I am clueless about section 7.3,
> where it talks about using some pins as inputs at the same time that
> other pins are used as outputs. The reference to Figure 15 isn't
> helping. It sounds like the chip is mainly intended to be used as an
> "all inputs" or "all outputs" device, but it has some voodoo that
> can make it pretend to do mixed I/O if you line up various planets...
It looks like when you want a pin to act as an input, you must
set it HIGH (which also is the power on state). In that case an external
device may pull the pin HIGH or LOW (and when LOW, sink the
current from the 100uA currect source. You probably should take
care not to write a LOW to that pin in this case...
When using a pin as output, you just send a HIGH or LOW to that
pin as you want. But note that when HIGH, it can only source 100uA
(I think)...
Now, the thing I don't understand, is the extra FET that, when ON,
shorts the 100uA current source and ties the pin hard HIGH. But
this might be an missunderstanding...
Anyway, on the URL you quoted above, are also AN469, which
better explains this. There are also a few very similiar devices
(from Philips) but with separate I/O-direction control registers
(also described in the AN469 app note).
And, there are also the MCP23016, which is a very similar
device from Microchip. You cold get three free samples to play
with from them :-)
> The other bit of confusion has to do with the "how are i2C slaves
> intended to be used" department. The timing diagrams imply that
> you can read a slave's data by either
>
> START, address-a-chip, READ, STOP
> or
> START, address-a-chip, READ, READ, READ, READ, ..., STOP
>
> In the second case, I'm assuming that since the 8574 only has a
> single 8-bit chunk of data to read, it simply resends the current
> (possibly changing) states as the READs are processed.
As I understands it.
> Or (and
> thus my confusion), is the multi-read case only for devices that
> have more than one byte of data to read?
No, I don't think so.
> Obviously, I'm missing something basic here - can anyone share a
> clue or two to help?
No voodo there, the ports are quasi-bidirectional. When configured
as an input, think of "week pull-up" nothing else. I use that IC often,
it is inexpensive and save me lots of I/O lines on the MCU.
It has an interrupt output, which is very convenient some times.
I have relocatable code for it (16f series only), if you are interested
I can send it to your e-mail address. I don't post attachments here.
VV
John Plocher <spam_OUTjohn.plocherTakeThisOuTSUN.COM> wrote:
>I am starting to play with I2C and the 8574 I/O expander chip,
>and I am running into some of those "I don't think I understand
>the manual" types of problems.
[snip]
>I think I grok the cases where the chip is used as either 8 bits
>of input or 8 bits of output, but I am clueless about section 7.3,
>where it talks about using some pins as inputs at the same time that
>other pins are used as outputs.
[snip]
>....but it has some voodoo that
>can make it pretend to do mixed I/O if you line up various planets...
---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online
No voodo there, the ports are quasi-bidirectional. When configured
as an input, think of "week pull-up" nothing else. I use that IC often,
it is inexpensive and save me lots of I/O lines on the MCU.
It has an interrupt output, which is very convenient some times.
I have relocatable code for it (16f series only), if you are interested
I can send it to your e-mail address. I don't post attachments here.
VV
John Plocher <john.plocherKILLspamSUN.COM> wrote:
>I am starting to play with I2C and the 8574 I/O expander chip,
>and I am running into some of those "I don't think I understand
>the manual" types of problems.
[snip]
>I think I grok the cases where the chip is used as either 8 bits
>of input or 8 bits of output, but I am clueless about section 7.3,
>where it talks about using some pins as inputs at the same time that
>other pins are used as outputs.
[snip]
>....but it has some voodoo that
>can make it pretend to do mixed I/O if you line up various planets...
---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online
seems all to be correct!
the moment you write a 1 to a pin, the pin pulls up with max. 1ma, while the second fet is on. then, after a short time, this fet is turned off and the pin only sources the 100ua from the other fet.
so after writing a 1 to the pin, you can also use it as an input (with integrated pull-up)
tino
seems all to be correct!
the moment you write a 1 to a pin, the pin pulls up with max. 1ma, while the second fet is on. then, after a short time, this fet is turned off and the pin only sources the 100ua from the other fet.
so after writing a 1 to the pin, you can also use it as an input (with integrated pull-up)
tino
>> I think I grok the cases where the chip is used as either 8 bits
>> of input or 8 bits of output, but I am clueless about section 7.3,
>> where it talks about using some pins as inputs at the same time that
>> other pins are used as outputs. The reference to Figure 15 isn't
>> helping. It sounds like the chip is mainly intended to be used as an
>> "all inputs" or "all outputs" device, but it has some voodoo that
>> can make it pretend to do mixed I/O if you line up various planets...
>
>It looks like when you want a pin to act as an input, you must
>set it HIGH (which also is the power on state). In that case an external
>device may pull the pin HIGH or LOW (and when LOW, sink the
>current from the 100uA currect source. You probably should take
>care not to write a LOW to that pin in this case...
Correct. each pin has an internal high value pull up just like can be
enabled on the PIC RB pins, except it cannot be turned off on the PCF8574.
>When using a pin as output, you just send a HIGH or LOW to that
>pin as you want. But note that when HIGH, it can only source 100uA
>(I think)...
Correct, but this is plenty for most purposes. In my case this is plenty to
drive a ULN2803 to sufficiently high to make relays come on.
>Now, the thing I don't understand, is the extra FET that, when ON,
>shorts the 100uA current source and ties the pin hard HIGH. But
>this might be an missunderstanding...
This is pulsed when the port output is driven to a "1" state, to give a
rapid pullup to any capacitive load that may be on the port. However it is
not left on so that the 100uA source can be used to allow the port as an
input port.
This is really quite a nice chip to get an easy to use 8 bit port on an I2C
bus. You can have up to 8 of the non-A version, and up to 8 of the -A
version, giving the potential for 16 ports. The only difference between the
two versions is the base address on the I2C bus.
-- http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
>> I think I grok the cases where the chip is used as either 8 bits
>> of input or 8 bits of output, but I am clueless about section 7.3,
>> where it talks about using some pins as inputs at the same time that
>> other pins are used as outputs. The reference to Figure 15 isn't
>> helping. It sounds like the chip is mainly intended to be used as an
>> "all inputs" or "all outputs" device, but it has some voodoo that
>> can make it pretend to do mixed I/O if you line up various planets...
>
>It looks like when you want a pin to act as an input, you must
>set it HIGH (which also is the power on state). In that case an external
>device may pull the pin HIGH or LOW (and when LOW, sink the
>current from the 100uA currect source. You probably should take
>care not to write a LOW to that pin in this case...
Correct. each pin has an internal high value pull up just like can be
enabled on the PIC RB pins, except it cannot be turned off on the PCF8574.
>When using a pin as output, you just send a HIGH or LOW to that
>pin as you want. But note that when HIGH, it can only source 100uA
>(I think)...
Correct, but this is plenty for most purposes. In my case this is plenty to
drive a ULN2803 to sufficiently high to make relays come on.
>Now, the thing I don't understand, is the extra FET that, when ON,
>shorts the 100uA current source and ties the pin hard HIGH. But
>this might be an missunderstanding...
This is pulsed when the port output is driven to a "1" state, to give a
rapid pullup to any capacitive load that may be on the port. However it is
not left on so that the 100uA source can be used to allow the port as an
input port.
This is really quite a nice chip to get an easy to use 8 bit port on an I2C
bus. You can have up to 8 of the non-A version, and up to 8 of the -A
version, giving the potential for 16 ports. The only difference between the
two versions is the base address on the I2C bus.
-- http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
> This [PCF8574] is really quite a nice chip to get an easy to use 8 bit
> port on an I2C bus. You can have up to 8 of the non-A
> version, and up to 8 of the -A version, giving the potential
> for 16 ports. The only difference between the two versions
> is the base address on the I2C bus.
Has anyone had the chance to compare with the Microchip
MCP23016 part ? With that you get :
- Two full 8-bit ports.
- True Input or output pins with 25mA source and sink as output.
- Programmable "inverter" for input bits.
- R/W "latch" regs, like the 18-series. You can read back what was
written, not what's on the actual pins.
- Two "capture" regs that takes a "snapshot" of the inputs at the
actual time of the interrupt.
And it's $2.66 in single quantity (BuyMicrochip-US) v.s $2.00
for the Philips part (single quant from Digikey), so less cost/pin.
Note that there is a rev.B data sheet for the MCP23016 since
sep-2003. The former A data sheet was "Preliminary"...
I've got the impression that the MC part is a bit less popular,
it's "non stock" at Digikey...
Jan-Erik.
-- http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
> This [PCF8574] is really quite a nice chip to get an easy to use 8 bit
> port on an I2C bus. You can have up to 8 of the non-A
> version, and up to 8 of the -A version, giving the potential
> for 16 ports. The only difference between the two versions
> is the base address on the I2C bus.
Has anyone had the chance to compare with the Microchip
MCP23016 part ? With that you get :
- Two full 8-bit ports.
- True Input or output pins with 25mA source and sink as output.
- Programmable "inverter" for input bits.
- R/W "latch" regs, like the 18-series. You can read back what was
written, not what's on the actual pins.
- Two "capture" regs that takes a "snapshot" of the inputs at the
actual time of the interrupt.
And it's $2.66 in single quantity (BuyMicrochip-US) v.s $2.00
for the Philips part (single quant from Digikey), so less cost/pin.
Note that there is a rev.B data sheet for the MCP23016 since
sep-2003. The former A data sheet was "Preliminary"...
I've got the impression that the MC part is a bit less popular,
it's "non stock" at Digikey...
Jan-Erik.
-- http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads