Hi guys,
I know that I studied in the university about this, but I can't remember now.
I need to collect more than 10 values in the ports, but I have just 8 ports avaliable!
Could some one explain how I can customize it?
thanks,
Joao
Hi,
If you could be more specific address what your problem is; maybe someone could help you. Since you are in PIC C than I would assume that you are talking about PIC uC. You said you need to collect more than 10 value in the ports but you have only 8 ports available. well, I think you are talking about the PIC port.
In the case of PIC port:
If you need more than 8 bits than use two ports (ex. RB and RC) for 16 bits. You would read each port and save the value in to each variable. One is LOW byte and other is HI byte. Now you have 16 bits variable and how to use is your.
If you have only one port available then you could use TWO 74HC541 (or three, or more), depend on how many bit you want. Let say you only want 16 bits than use two 74HC541, connect the Ys side to the port of PIC. use two othe pins to clock in the data.
Connect pin 1 & 19 of HC541 together, this is active low clk.
To read the data, select one of the HC541 by pull LOW on pin 1&19. Read port and save to a variable. Set HI on pin 1&19 to bring the output of HC541 to hi-Z. Now do the same to the other HC541. After two read you have two bytes of 8 bits.
True state for 74HC541:
G1 G2 A y
L L L L
L L H H
H x x Z (Hi Z if any of the G high)
x H x Z
Read the data sheet for more detail.
This is how I do when I want more port for input and output when I run out of pin on the PIC. You may want to use 74HC374 for bi-direction and latch if your application needs (I used for output)
Hope this help,
Tom