'Tab': What is undefined identifier?

Source: Internet
Author: User

The source code is as follows:

Include <reg51.h>
# Include <string. h>
Void main ()
{
Unsigned char tab [] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f}; // segment code table
Void display (unsigned char I );
Void delay (unsigned char I );
Ie = 0x81;
Scon = 0x00;
Tcon = 0x00;
Tmod = 0x10;
While (1)
{
P0 = 0x9e;
P1 = 0xf7; // the red light on the east and west, and the green light on the north and south
Display (55 );
P0 = 0xae;
P1 = 0xfb; // red light on east/west, yellow light on north and south
Display (5 );
P0 = 0xf3;
P1 = 0xfc; // the green light on the east and west, and the red light on the north and south
Display (55 );
P0 = 0x75;
P1 = 0xfd; // yellow light on East and West, red light on north and south
Display (5 );

}
}
Void inter0 (void) interrupt 0
{
P0 = 0xb6;
P1 = 0xfd; // the red light is on both the east and west sides
Display (30 );
}
Void display (unsigned char I)
{
While (I! = 0)
{
Unsigned char J, K;
J = I % 10;
Sbuf = tab [J];
While (Ti! = 1 );
Ti = 0;
K = I/10;
Sbuf = tab [k];
While (Ti! = 1 );
Ti = 0;
Delay (20 );
I --;
}

}
Void delay (unsigned char I)
{
Tr1 = 1;
While (I! = 0)
{
Th1 = 0x9e;
TL1 = 0x58;
While (TF1! = 1 );
TF1 = 0;
I --;
}
Tr1 = 0;
}

After compilation, an error occurs: 'tab': Undefined identifier. What is the problem? I don't know much about C language. Thank you for your understanding!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.