main.h
#ifndef _MAIN_H
#define _MAIN_H
#define uint unsigned int
#define uchar unsigned char
#endif
delay.c
void delay(uint timer)
{
uchar j = 124;
while(timer--)
{
while(j--);
}
}
delay.h
#ifndef _DELAY_H
#define _DELAY_H
void delay(uint timer);
#endif
display.c
void display(uint k)
{
uchar i;
for(i=0; i<segN; i++)
{
int result=1;
num[segN-i-1]=k/result%10;
result*=10;
k/=10;
P2 = segW[i];
P0 = segD[num[segN-i-1]];
delay(1);
}
}
display.h
#ifndef _DISPLAY_H
#define _DISPLAY_H
void display(uint k);
#endif