#include<at89c52.h>
#include"RLCTest.h"
union count
{
struct clockTwo
{
unsigned char clockH;
unsigned char clockL;
}clockTwo;
unsigned int clock;
}count; //定義頻率字
unsigned char code disdata[16]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e}; unsigned char data dismem[8];
//定義LED顯示頻段
-----------------------------------------
系統初始化
void init(void)
{
stateR=0;testR=1;
stateC=1;testC=0;
stateL=1;testL=0;
largeR=1;smallR=0;
largeC=1;smallC=0;
}
void delay4us(unsigned int time)
{
while(--time);
}
void delay2us(unsigned char time)
{
while(--time);
}
void inittime(void)
{
TMOD=0x15;//C/T 0 為計數器,用于頻率計數。C/T 1 為定時器。用于動態顯示
TH1=0xF8;//timer1=2ms
TL1=0x2f;
ET1=1;
EA=1;
TR1=1;
TR0=1;
ET0=1;
///timer 2
T2CON=0x04;
T2MOD=0x00;
TH2=0x3C;
TL2=0xB0;
RCAP2H=0x3C;
RCAP2L=0xB0;
TR2=1;
ET2=1;
}
這是程序 求好心大神 留郵箱 我把仿真發給你 跪求
|