#include "reg52.h"
code unsigned char segCode[10] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99,
0x92, 0x82, 0xf8, 0x80, 0x90
};
void delay(unsigned int t);
void main()
{
unsigned char i;
while (1)
{
for (i = 0; i < 8; i++)
{
P0 = 0xFF;
P2 = ~(0x01 << i); // 给电源 1111 1110
P0 = segCode[i]; // 给字形码
code unsigned char segCode[10] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99,
0x92, 0x82, 0xf8, 0x80, 0x90
};
void delay(unsigned int t);
void main()
{
unsigned char i;
while (1)
{
for (i = 0; i < 8; i++)
{
P0 = 0xFF;
P2 = ~(0x01 << i); // 给电源 1111 1110
P0 = segCode[i]; // 给字形码