Discussion in "PIC Microcontroller Discussion" started by    arp    Dec 24, 2007.
Mon Dec 24 2007, 02:15 pm
#1
Dear sir,
I have an appln wherer i have to read 4 line status connected to 74hc165 as 4 parallel i/p.i have interfaced this IC to PIC micro.Basically i am using 3 pins ....1) CP 2) PL 3) Q7.
CE pin is gnd.Could anyone has sample C code.My understanding to read 4 line status is steps as below:
1) CLK -> HIGH
2) PL -> LOw
3) PL-> HIGH
4) repeat in loop 4times ....
a) read the pin value and shift the result in a read165 variable.
b) CLK -> LOW
c) CLK -> HIGH
5) PL -> LOW
6) Now analyze the status.

pls review and help ..

regards,
arp
Mon Dec 24 2007, 02:44 pm
#2
can you show me circuit you made? just want to review it before moving further..
 arp like this.
Mon Dec 24 2007, 03:18 pm
#3
Dear sir,
i don't have the soft copy.But the signals from PIC MCU are connected to 74hc165 as below.
RB1(o/p) -> clk pin of 74hc165 (2)
RB2(o/p) -> parallel load i/p pin of 74hc165 (1)
RC7(i/p) -> serial o/pk pin of 74hc165 (9)
and VCC , GND
Clk Enable i/p pin of 74hc165 (15) is gnd.Other pins are not connected.

PIC MCU crystal -> 20MHz

Regards,
arp
Mon Dec 24 2007, 03:41 pm
#4
you mean you are taking serial i/p..?
make sure you have chosen right IC. because 74HC165 is an 8-bit parallel in-serial out shift register..
Mon Dec 24 2007, 03:50 pm
#5
dear sir,
As i said in my earlier post i am using this ic as parallel in serial ou only.If you look at closely you will find that serial out pin i.e pin 9 of 74hc165 connected to Microcontroller RC7 as a i/p.
Is it ok?

let me know.

regards,
arp
Mon Dec 24 2007, 04:22 pm
#6
so your circuit is like..
D0 to D7 connected to one of the port and then you enter data.. and read it back..
is it?
you do not have to load everytime..
once loading is done.. all you need to do is send clock signal.. and during the transition read it back from Pin 9..

its like...
put data on lines...
PL -> low
PL -> high
loop{
clock->high
read bit
clock->low
}
check status...
Mon Dec 24 2007, 05:26 pm
#7
thanks,
yes D0 to D7 will be i/p to 74HC165 but they are from external circuit not from the same microontroller.we have to read these 7 i/p lines so we have used 74hc165 inbetween those 7 signals and microcontroller.then i will do my coding as you said.i.e
PL-> low
PL->high
loop{
clk-> high
read bit
clk->low
shift bit into data.
}
is data shuld be read in low to high transition??
is there any timing issues? any delay need to be implemented.
thnx,
arp
Mon Dec 24 2007, 05:47 pm
#8
all times are in nano seconds if you check the AC characteristics on Page 8 of datasheet.. so no timing problems.. if you want add one NOP..
and on page 9 the first waveform shows that the data is sampled at low to high transition of the clock.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am