at89c52测频率程序求助 小白 求大神
时间:10-02
整理:3721RD
点击:
#include <reg52.h>
#include <stdio.h>
#include <intrins.h>
#include <absacc.h>
extern serial_initial();
unsigned int a;
unsigned int n;
unsigned int count;
#define SEGMENT XBYTE[0x7fff]
#define BIT_LED XBYTE[0xbfff]
unsigned char code seg_code[]={0x3f,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6f,0x77,0x7C,0x39,0x5E,0x79,0x71,0x00};
main()
{
serial_initial();
TMOD=0x51;
TH0 = 0x4c;
TL0 = 0x00;
TL1 = 0x00;
TH1 = 0x00;
TR0=1;
TR1=1;
EA=1;
n=0;
count=0;
a=0;
while(1)
{
if(count==20)
{
TR1=0;
TR0=0;
a=n*65536+TH1*256+TL1;
a=a-1;
printf("a=%s",a);
n=0;
count=0;
TH0 = 0x4c;
TL0 = 0x00;
TL1 = 0x00;
TH1 = 0x00;
TR0=1;
TR1=1;
ET0=1;
ET1=1;
EA=1;
}
}
}
void TIME0(void) interrupt 1
{
count ++;
TH0 = 0x4c;
TL0 = 0x00;
}
void TIME1(void) interrupt 3
{
n++;
TL1 = 0x00;
TH1 = 0x00;
}
#include <stdio.h>
#include <intrins.h>
#include <absacc.h>
extern serial_initial();
unsigned int a;
unsigned int n;
unsigned int count;
#define SEGMENT XBYTE[0x7fff]
#define BIT_LED XBYTE[0xbfff]
unsigned char code seg_code[]={0x3f,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6f,0x77,0x7C,0x39,0x5E,0x79,0x71,0x00};
main()
{
serial_initial();
TMOD=0x51;
TH0 = 0x4c;
TL0 = 0x00;
TL1 = 0x00;
TH1 = 0x00;
TR0=1;
TR1=1;
EA=1;
n=0;
count=0;
a=0;
while(1)
{
if(count==20)
{
TR1=0;
TR0=0;
a=n*65536+TH1*256+TL1;
a=a-1;
printf("a=%s",a);
n=0;
count=0;
TH0 = 0x4c;
TL0 = 0x00;
TL1 = 0x00;
TH1 = 0x00;
TR0=1;
TR1=1;
ET0=1;
ET1=1;
EA=1;
}
}
}
void TIME0(void) interrupt 1
{
count ++;
TH0 = 0x4c;
TL0 = 0x00;
}
void TIME1(void) interrupt 3
{
n++;
TL1 = 0x00;
TH1 = 0x00;
}
要说明是什么问题,什么不正确的现象,光贴程序,很难判断的
窗口显示失败,什么也没打出来
是我的循环出问题了吗
求助
窗口显示失败,什么也没打出来
串口初始化了吗,
TMOD=0x51;
TH0 = 0x4c;
TL0 = 0x00;
TL1 = 0x00;
TH1 = 0x00;
TR0=1;
TR1=1;
TR1=0;
TR0=0;
可以直接停定时器吗
求问显示方框怎么办
51单片机可以直接用printf吗?硬件上接什么?打印机、显示器?