PDA

View Full Version : PCF8574 Example…..



andybarrett1
- 15th November 2014, 21:21
Hi… Thank you for reading.

I am experimenting with some Texas PCF8574's and a pic (16f688). All is good.

My questions;

My outputs are all sinking…i.e. 0's. Is there a way of outputting 1's (Source) when true without using external transistor ?

Although I have managed to read and write to and from the device…. can I split the 8 bits. 4 read and 4 write for example.

Do I aways have to write a 1 to the inputs before a read.

Thank you for reading and understanding.

Andy

richard
- 17th November 2014, 05:44
Is there a way of outputting 1's (Source) when true without using external transistor ?

according to my data sheet the Io source current is 300uA where the Io sink current is 25mA , is 300uA enough ? if not no

Dave
- 17th November 2014, 12:53
Why yes you do, The device reads the condition of the output pins, Therefore if you were to set all of the pins low, so as to be sinking current, the readback data would be 00000000. If you want to readback say 4 of the pins that are connected as inputs, you would always mask the output byte with the appropriate input pins set to true. say you want the upper 4 bits to be used as inputs and the lower 4 to be used as outputs, you would always send the output byte masked with 1111 in the upper bit positions by ORING it with %11110000 just before sending it to the device. Then when reading the the device you would mask off the output bits by ANDING the returned byte with %11110000. I have used these I/O expanders for years and they word very well.

andybarrett1
- 17th November 2014, 19:17
Hi David

I am a hardware engineer so talk simple to me... :-)
Maybe an example would help me... If can get it to do what I want will move over to the 16Bit version 8 in 8 out.

Also a radio ham G7IIF

Thank you for help

73 de Andy