gauravkothari23
Advanced Member level 2
Hi all...
i am trying to interface 74HC595 Shift register with 89S52 (Circuit diagram attached).
it works perfectly in proteus. but when the same i try implementing in the actual hardware, nothing happens, the status on LED's does not change.
Can anybody please let me know where the problem is. i also tested the PCB for any shorts or broken tracks, but thats not a problem.
code:
i am trying to interface 74HC595 Shift register with 89S52 (Circuit diagram attached).
it works perfectly in proteus. but when the same i try implementing in the actual hardware, nothing happens, the status on LED's does not change.
Can anybody please let me know where the problem is. i also tested the PCB for any shorts or broken tracks, but thats not a problem.
code:
Code:
#include <REG51.h>
#include <STDIO.h>
sbit data1 = P2^0; //DS
sbit clock = P2^2; //SH_CP
sbit latch = P2^1; //ST_CP
sbit led = P3^7;
void msdelay(unsigned int value)
{
unsigned int i,j;
for(i=0;i<value;i++)
for(j=0;j<100;j++);
}
void leddata(unsigned char databyte)
{
int i;
for(i=0;i<8;i++)
{
data1 = ((databyte&0x80) == 0x80);
clock=1;
msdelay(2);
clock=0;
msdelay(100);
databyte = databyte << 1;
}
latch=1;
msdelay(2);
latch=0;
}
void main(void)
{
data1=0;
clock=0;
latch=0;
while(1)
{
led=~led;
leddata(0xd9);
}
}