Nikunj Tanna
Advanced Member level 4
- Joined
- Dec 8, 2009
- Messages
- 115
- Helped
- 23
- Reputation
- 46
- Reaction score
- 15
- Trophy points
- 1,298
- Location
- Ahmedabad, Gujarat, India
- Activity points
- 1,985
Hello all,
I wan to get serial output from 74hc165. I've made hardware according to datasheet and made code in keil but anyhow i didn't get the outputs.
i've connected
pin 16-5v
pin 8,15 - gnd
pin 1-2-9 to port pins
pin 7,10 - left unconnected.
and on parallel inputs, i am giving high or low for testing.
i am displaying ouput on port 0 by leds.
confusion is about the state of clk(pin 2), ce(pin 15) and pl(pin 1)
should pin 10 be ground for single 74hc165 operation.
here is the code:
#include <REGX51.H>
sbit pl=P2^0; //parallel load input
sbit cp=P2^1; //CP
sbit q7=P2^2;
sbit led= P1^0;
void msdelay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
void main()
{
unsigned char datas = 0,k;
P0 = 0x00;
P2 = 0x00;
P2 |= 0x04;
cp = 0 ;
pl = 0 ;
msdelay(2);
cp = 1;
pl = 1;
if(q7)
datas = datas+1;
for(k = 0; k < 7; k++)
{
cp = 0;
datas<<=1;
msdelay(2);
cp = 1;
msdelay(2);
if(q7)
datas = datas+1;
}
while(1)
{
P0 = datas;
}
}
So tell me how to get outputs?
thank you.
NIKS
I wan to get serial output from 74hc165. I've made hardware according to datasheet and made code in keil but anyhow i didn't get the outputs.
i've connected
pin 16-5v
pin 8,15 - gnd
pin 1-2-9 to port pins
pin 7,10 - left unconnected.
and on parallel inputs, i am giving high or low for testing.
i am displaying ouput on port 0 by leds.
confusion is about the state of clk(pin 2), ce(pin 15) and pl(pin 1)
should pin 10 be ground for single 74hc165 operation.
here is the code:
#include <REGX51.H>
sbit pl=P2^0; //parallel load input
sbit cp=P2^1; //CP
sbit q7=P2^2;
sbit led= P1^0;
void msdelay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
void main()
{
unsigned char datas = 0,k;
P0 = 0x00;
P2 = 0x00;
P2 |= 0x04;
cp = 0 ;
pl = 0 ;
msdelay(2);
cp = 1;
pl = 1;
if(q7)
datas = datas+1;
for(k = 0; k < 7; k++)
{
cp = 0;
datas<<=1;
msdelay(2);
cp = 1;
msdelay(2);
if(q7)
datas = datas+1;
}
while(1)
{
P0 = datas;
}
}
So tell me how to get outputs?
thank you.
NIKS