【正文】
display()。 START=1。 a=P0^7*128+P0^6*64+P0^5*32+P0^4*16+P0^3*8+P0^2*4+P0^1*2+P0^0*1。 delay(10)。 START=1?! ?/總中斷使能 intial()?! ?/下降延中斷 EX0=1。 } void main(void) { unsigned int a=0。 time[10]=second/10+0x30。 time[8]=minute/10+0x30。 time[6]=hour/10+0x30。 time[4]=day/10+0x30。 time[2]=month/10+0x30?! ?/小數(shù)位 } void convert2(void) { time[0]=year/10+0x30?! ?/個(gè) w_dat(0x2e)?! ?/顯示數(shù)據(jù)存儲(chǔ)器首地址 w_dat(LCD_bit[2])。 w_dat(time[11])。 w_(0xc8)?! ?/分 w_dat(time[8])。 w_dat(0x3A)?! ?/顯示數(shù)據(jù)存儲(chǔ)器首地址 w_dat(time[6])。 //日 w_dat(time[5])。 w_(0x8A)。 //月 w_dat(time[3])。 w_(0x87)?! ?/年 w_dat(time[1])?! ?/顯示字母2 w_dat(0x30)?! ? w_(0x82)。 w_dat(time[11])。 } //分 w_(0xC9)。 w_dat(time[8])。 delay(2)。 w_dat(0x20)。 w_dat(time[9])。 } //時(shí) else if(j==2) { w_(0xC6)。 w_dat(time[6])。 delay(2)。 w_dat(0x20)。 w_dat(time[7])。 } //日 else if(j==4) { w_(0xC2)。 w_dat(time[5])。 w_(0x8A)。 w_dat(0x20)。 w_(0x8A)。 w_dat(time[4])。 w_dat(0x2D)。 w_dat(time[2])。 delay(2)。 w_dat(0x20)。 w_dat(time[3])。 } //年 10 else if(j==8) { w_(0x87)。 w_dat(time[1])。 w_(0x84)。 w_dat(0x20)。 w_(0x84)。 w_dat(time[0])?! ?/顯示字母2 w_dat(0x30)。 w_(0x82)。 if(m==0x0A) k=0。 m=m+2。amp。 *(addr+num)+=1。amp。amp。 *(addr+num)+=1。amp。amp。amp。 *(addr+num)+=1。amp。amp。amp。 *(addr+num)+=1。amp。amp。amp。 *(addr+num)+=1。amp。amp。amp。 *(addr+num)+=1。amp。amp。amp。 break。 break。 break。 break。 break。 displayD(num)。 }//* * * * * * * * * *INT0中斷服務(wù)程序* * * * * * * * * void INT0_ISR(void) interrupt 0 { uchar k=1,m=0,n=0,j=0,h=0,num=9。 E=0。 RW=0。 P0=dat。 E=0。 RW=0。 P0=。 E=0。 E=1。 RS=0。 w_(0x0C)。 //顯示為8位兩行字符 w_(0x08)。 w_(0x38)。 delay(100)。 RW=0。 time_b=0x1e。 //月初值:05 *(addr+9)=0x0a。 //時(shí)初值:12 *(addr+7)=0x0f。 //可以設(shè)置124小時(shí)制 *(addr+2)=0x00。 } void intial(void) { time_a=0x70。 minute=*(addr+2)。 day=*(addr+7)。 } void get_time(void) { year=*(addr+9)。 LCD_bit[2]=s/100+0x30。 if(k=5) { s=s+1。 s=s+j。 m=(n%100)*57。 i=n/100。 } unsigned char LCD_bit[3]={0,0,0}。n0。 void INT0_ISR()。 void convert1(unsigned long n)。 void delay(unsigned long n)。 void w_dat(uchar dat)。 void busy()。 void intial(void)。 uchar time[12]={0}。 //讀寫(xiě)控制 sbit RS=P1^0。 //忙信號(hào) sbit E=P1^2。 //鍵盤(pán) uchar xdata *addr=0x7f00。 //鍵盤(pán) sbit INC=P2^3。 //start為控制信號(hào) sbit RESET=P3^2。 Technology, Nanjing 21004AbstractThe object of this paper is to design a noncontact thermometer which utilizes the SCM AT89S52 as the core and follows the theory of infrared temperature measurement. Basically, hardware and software pose the whole system. For its hardware part, the paper initially proposes the overall circuit design, then infrared sensors, the amplification of voltage signal, A\D conversion, realtime clock, the voltage conversion between positive and negative and its displaying module are all designed respectively. For its software part, the general programming is designed. After that, the program of the module of A\D conversion, data processing, realtime clock, interrupt and displaying are all designed correspondingly. owing to its modular designing, the system turns out to be convenient in programming and maintenance. It also has the advantages of clear structure, reliability and modifiability. The ideas and the framework of this design are all illustrated. Finally we realize the function of noncontact thermometer.Keywords: SCM, Pyroelectric infrared sensor, temperature, LCD附錄一、原理圖