#include<reg52.h>
#include"NBCTFT.h"
#include<stdio.h>
#define Blue 0x001F
#define Red 0xF800
sbit led=P3^2;
#define uchar unsigned char
#define uint unsigned int
unsigned int Device_code;
uchar temp=0;
long int period=0;
uchar Periodus[16]= " ";
//***********************************************************************************
//主函数
//***********************************************************************************
main()
{
Device_code=0x9328 ;
TFT_Initial();
CLR_Screen(Blue);
TMOD = 0x09;
TH0 = 0x3c;
TL0 = 0xb0;
ET0 = 1;
EA = 1;
while(led == 1 );
TR0 = 1;
while( led == 0 );
while( led == 1 );
TR0 = 0;
period = 50000 *temp+ TH0 * 256 + TL0;
while(1) //等待中断产生,按下 S15 按键产生中断信号
{
sprintf(Periodus,"%ld",period);
LCD_PutString(120, 160,Periodus, Red ,Blue) ;
}
}
void t1() interrupt 1
{
TH0 = 0x3c;
TL0 = 0xb0;
temp++; //每进一次中断,temp 加 1
} |