Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to interface 74hc165 parallel in serial out in C?

Status
Not open for further replies.
74hc165 mcu

This is not a general matter of c language rather than of processor(?) and compiler(?) specific IO-functions. Also you didn't tell which side (parallel or serial) you want to interface.
 
74hc165 circuit

i am using d0 to d7 as parallel inputs ,
pin 1 - pl(parallel load).
pin2 - clock.
pin7 q' - complementary o/p.
pin9 - serial output.
pin 10 ground
pin15 - clock inhibit - ground.

**i am sending data on portd of microcontroller and connecting it to parallel input **of 74hc165 .
**i am not sure wether my data is loading into register of shifter.....

**i want to see the parallel data on port b after reading it serially...




my logic :

#define data_pin portf.f0
#define clk portf.f1
#define pl portf.f2

main()
{
trisf = 0b00000001;
trisb= 0b00000000;


clk = 0 ; // portf.f1
pl = 0 ; // portf.f2
pl = 1; //portf.f2

for(i = 0; i < 8; i++)
{

temp = data_pin ; read status of uc pin(which is connected to serial o/p)
clk = 1;
clk = 0;

data = data | temp ;
data <<= 1;
}

while(1)
{
portb = data;
}



}



but i am not getting data out from serial out pin when i see on cro
 

74hc165

How to connect two 74HC165 with each other?
 
how does a 74hc165 works

dear friend , i am messed up in one , you are talking of two , have you interfaced it using c language
 

Re: 74hc165?

It should basically work this way. Cause the shown code isn't complete and has some inconsistencies, e. g. the pl parallel load is undefined, also data is possibly uninitialized, I can't say exactly. However, I would suggest to run the parallel load and serial shift continuously in a loop with varying parallel input, than it can be watched more easily with an oscillospcope. You should check, if all signals are actually operated as intended. Regarding your second question, HC165 has only one set of registers, thus parallel loaded data appears immediately at the output. You should be able to see this (if the value is changing).
 
74hc165?

the value is not changing... i have made changes in the code with pl...

what inconsistencies do u see and data initialization....
 

Re: 74hc165?

I meant the data variable, but not initializing it would only affect the first bit. If you have an oscilloscope, you are able to watch any signal for correct operation. That's better than guessing from the remote about a code or a circuit that may be different in any important detail.

1. Setting SH/nLD input to low causes serial output to follow pin 6 input (and to load the other internal registers)

2. Applying one clock pulse with SH/nLD = 1 advances to the next serial bit.

If this behaviour can't be observed, either the HC165 is wired incorrect, an input signal is missing or the device is defective.
 
Re: 74hc165?

jit_singh_tara said:
dear friend , i am messed up in one , you are talking of two , have you interfaced it using c language

Hi, I interfaced 74HC165 with 16F630 and it is works fine.

By the way, I used basic language

I need the connections for wire two 74HC165 with each other
 
Re: 74hc165?

Hi,
Try the following modified code.
Regards,
Laktronics.

#define data_pin portf.f0
#define clk portf.f1
#define pl portf.f2

main()
{
trisf = 0b00000001;
trisb= 0b00000000;
unsigned char data = 0;

clk = 0 ; // portf.f1
pl = 0 ; // portf.f2
//delay() // may need to call a few microsec.delay here, and other marked places too
pl = 1; //portf.f2
//delay()

If(data_pin) // read status of uc pin(which is connected to serial o/p)
data = data+1;
for(i = 0; i < 7; i++)
{
data<<1;
clk = 1;
//delay()
clk = 0;
//delay()
If(data_pin) // read status of uc pin(which is connected to serial o/p)
data = data+1;
}

while(1)
{
portb = data;
}

}
 
Re: 74hc165?

Hi,
And to Hassan, when someone is 'hitting so hard his head on the table' to solve his problem why do you want to add to the weight of his head?!!, could have started a new thread.
You can easily connect the second IC as follows:

1. Connect all parallel data inputs in parallel to same port.

2. Use the same shift clock.

3. Use a different parallel Load pin on MCU.

4. Connect Serial out of second IC to Serial IN of the first.

That's it.

Regards,
Laktronics
 
Re: 74hc165?

yes laktronics is right....


thanks man....

mr hassan

you can always connect two. 74hc165 .. using basic is so easy , nothing skill involved in that , you use shiftin and pulsout....
try using c....

i am able to interface in c thanks laktronics....
you have answer to every problem... u r genius , i respect your knowledge...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top