sameer17kelaskar
Newbie
C:
#include<reg51.h>
#include<stdio.h>
void delay_ms(unsigned int count);
void main()
{
P1=0X00;
//int i;
//char seg_code[]={0x3F,0X06,0X5B,0X4F,0X66,0X6D,0X7D,0X07,0X7F,0X6F};
while(1)
{
int i;
char seg_code[]={0x3F,0X06,0X5B,0X4F,0X66,0X6D,0X7D,0X07,0X7F,0X6F};
for(i=0;i<=9;i++)
{
P1=seg_code[i];
delay_ms(1000);
}
}
}
void delay_ms(unsigned int count)
{
int j,k;
for(j=0;j<count;j++)
{
for(k=0;k<300;k++);
}
}
/********************************************************************************************************************************/
The above code runs perfectly. But if the integer and array initalization part preceeding the while loop which is currently comment, is enabled the compiler gives error. I'm a rookie in C programming any help is appriciated.