[SOLVED] Interfacing 7-segment led using 74HC595

Status
Not open for further replies.

deeplearns

Member level 4
Joined
May 19, 2011
Messages
75
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,939
I wants to use a 74hc595 to interface 7 segment display to 89c51 ...
What input should be given to the sh_cp st_cp and DS .

do i need to toggle the ips of sh_cp and st_cp for the 74hc595 as they are mentioned to be clock i/ps .

I am trying to run a basic program tyo understand the working of 74hc595
 

In the following code

void sen_data(unsigned char c)
{
unsigned char i,k;
LATCH =0;
SCK = 0;
for(i=0;i<8;i++)
{
DI = ( C & 0x80)?1:0;
SCK = 1;
c = c << 1;
SCK = 0;
}
LATCH = 1;



DI = ( C & 0x80)?1:0; what does this line do .. can u explain please and c = c << 1; will shift data from msb .... i suppose we have to shift data from lsb to Msb ...i am confused
 

c = c << 1 will shift data to left 0100 0000 << 1 will be 1000 0000 ... and wit uc data transfer we want to transfer the lsb and then shift ... I am confused .


Also DI = ( C & 0x80)?1:0; what does this line do

data in c will be anded with 0x80 so what does ?1:0
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…