求教,汇编频率记数器!

来源:百度知道 编辑:UC知道 时间:2024/06/19 22:22:26
请大家帮帮忙!我需要一个能在51单片机里用的频率记数器汇编程序!
***频率输入,数码管输出!!

有个C的 你自己把它弄成汇编吧

#include<reg52.h>
#include<math.h>
#define uchar unsigned char
#define unit unsigned int
#define ulong unsigned long //(共阴)
uchar code dispbit[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; // 定义位选
uchar code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x40};//定义段码
uchar dispbuf[8]={0,0,0,0,0,0,10,10}; //显示缓冲
uchar temp[8];
uchar dispcount;
uchar T0count;//T0计数
uchar timecount;//时间计数
bit flag;
ulong x;

void main(void)
{
TMOD=0x15;
TH0=0;
TL0=0;
TH1=(65536-4000)/256;
TL1=(65536-4000)%256;
TR1=1;
TR0=1;
ET0=1;
ET1=1;
EA=1;
while(1)
{
uchar i;
if(flag==1)
{
flag=0;
x=T0count*65536+TH0*256+TL0;
for(i=0;i<8;i++)
{
temp[i]=0;
}
i=0;
while(x/10)
{
temp[i]=x%10;
x=