#include <mcs51/at89c51ed2.h>
#define HC_LATCH P1_3
#define HC_CLK P1_2
#define HC_DATA P1_4
int cnt;
void delay(int a)
{
int i;
for(i = 0; i < a; i++); //null statement
}
void HC595_DISPLAY(unsigned char dat)
{
HC_LATCH = 0;
HC_CLK = 0;
for(cnt = 0; cnt < 16; cnt++)
{
HC_DATA = (dat & 0x01);
HC_CLK = 1;
delay(2);
HC_CLK = 0;
delay(2);
HC_LATCH = 1;
delay(2);
HC_LATCH = 0;
delay(0x600); // delay long enough to see LEDS
dat = dat >> 1;
}
}
int main()
{
while(1)
{
HC595_DISPLAY(0x0001);
}
}