MY friend is trying to program a shift register ic 74hc595 with 8051 microcontroller attached to display a moving led message.
But my compiler is giving me error in send_data(alf(a));
Here is code->
#include<8051.h>
#define clock P2_0
#define data_bit P2_1
#define latch P2_2
#define shift 8
void delay(unsigned int i)
{
int k=0;
while(k<i)
{
k++;
}
}
void send_data(unsigned char temp)
{
unsigned char i;
unsigned char dd;
latch=0;
clock=0;
for(i=0;i<shift;i++){
dd=temp>>i;
if(dd&1)
data_bit=1;
else
data_bit=0;
clock=1;
clock=0;
}
latch=1;
}
unsigned char alf[]={16,6,6,16};
void main()
{
unsigned char a;
while(1){
for(a=0;a<4;a++)
{
send_data(alf(a));
delay(10000);
}
}
}
Since its my friend who is making, i dont have much info about it. But if anything else is needed, please tell and i will provide but please help me solve this prob. Thanks.