1.Frequency calculator function

Utilize the regular counter functions of T0, T1 of AT89S51 one-chip computer, to finish counting the frequency to the signal input, the frequency result counted reveals through 8 dynamic nixie tubes. Require that be able to count the signal frequency of 0- 250KHZ accurately, the counting error does not exceed 1HZ.

2. Schematic circuit diagram

3. Programming content

1 . Timing / counter T0 and T1 operating mode is set up, pursued knowingly, T0 is the work under counting the state, go on, count to frequency signal that input, to work in T0 under the state of counting, the counter value of maximum is fOSC/24, because of fOSC =12MHz, so: It is 250KHz that the maximum of T0 counts the frequency. As to the thing that the concept of the frequency is to only count the pulsing number in one second to get frequency value. So T1 work in regular condition, arrive in the every one second such as timing, stop the count of T0, and read the number value counted from the counting unit of T0, then carry on data processing. Send to the nixie tube and reveal.

2 . T1 work in regular condition, maximum regular time 65ms, reach the timing of one second, adopt regular 50ms, the intersection of timing and 20, can finish regular function for 1 second altogether.

5. Source routine of language C

C procedure

#include

unsigned CHAR code dispbit[] ={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f} ;

unsigned CHAR code dispcode[] ={0x3f,0×06,0x5b,0x4f,0×66,0x6d,0x7d,0×07,

0x7f,0x6f,0×00,0×40} ;

unsigned CHAR dispbuf[8] ={0,0,0,0,0,0,10,10} ;

unsigned CHAR temp[8];

unsigned CHAR dispcount;

unsigned CHAR T0count;

unsigned CHAR timecount;

bit flag;

unsigned long x;

void mainvoid

{

unsigned CHAR i;

TMOD =0×15;

TH0 =0;

TL0 =0;

TH1 =6553*000 /256;

TL1 =6553*000 %6;

TR1 =1;

TR0 =1;

ET0 =1;

ET1 =1;

EA =1;

1.Frequency calculator function

Utilize the regular counter functions of T0, T1 of AT89S51 one-chip computer, to finish counting the frequency to the signal input, the frequency result counted reveals through 8 dynamic nixie tubes. Require that be able to count the signal frequency of 0- 250KHZ accurately, the counting error does not exceed 1HZ.

2. Schematic circuit diagram

3. Programming content

1 . Timing / counter T0 and T1 operating mode is set up, pursued knowingly, T0 is the work under counting the state, go on, count to frequency signal that input, to work in T0 under the state of counting, the counter value of maximum is fOSC/24, because of fOSC =12MHz, so: It is 250KHz that the maximum of T0 counts the frequency. As to the thing that the concept of the frequency is to only count the pulsing number in one second to get frequency value. So T1 work in regular condition, arrive in the every one second such as timing, stop the count of T0, and read the number value counted from the counting unit of T0, then carry on data processing. Send to the nixie tube and reveal.

2 . T1 work in regular condition, maximum regular time 65ms, reach the timing of one second, adopt regular 50ms, the intersection of timing and 20, can finish regular function for 1 second altogether.

5. Source routine of language C

C procedure

#include

unsigned CHAR code dispbit[] ={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f} ;

unsigned CHAR code dispcode[] ={0x3f,0×06,0x5b,0x4f,0×66,0x6d,0x7d,0×07,

0x7f,0x6f,0×00,0×40} ;

unsigned CHAR dispbuf[8] ={0,0,0,0,0,0,10,10} ;

unsigned CHAR temp[8];

unsigned CHAR dispcount;

unsigned CHAR T0count;

unsigned CHAR timecount;

bit flag;

unsigned long x;

void mainvoid

{

unsigned CHAR i;

TMOD =0×15;

TH0 =0;

TL0 =0;

TH1 =6553*000 /256;

TL1 =6553*000 %6;

TR1 =1;

TR0 =1;

ET0 =1;

ET1 =1;

EA =1;

while1

{

ifflag ==1

{

flag =0;

x=T0count*65536TH0*256TL0;

fori =0; i <8;i

{

temp[i] =0;

}

i =0;

whilex /10

{

temp[i] =x;

x=x/10;

i;

}

temp[i] =x;

fori =0; i <6;i

{

dispbuf[i] =temp[i];

}

timecount =0;

T0count=0;

TH0 =0;

TL0 =0;

TR0 =1;

}

}

}

void t0void interrupt 1 using 0

{

T0count;

}

void t1void interrupt 3 using 0

{

TH1 =6553*000 /256;

TL1 =6553*000 %6;

timecount;

iftimecount ==250

{

TR0 =0;

timecount =0;

flag =1;

}

P0 =dispcode[dispbuf[dispcount]];

P2 =dispbit[dispcount];

dispcount;

ifdispcount ==8

{

dispcount =0;

}

}