【正文】
an, the starting point of the ancient Silk Road, a trade channel established more than 2,000 years ago linking China, Central Asia and Europe. 。s cooperation with Central Asian countries, a senior official said. Shaanxi Governor Lou Qinjian said the province is fresh, rich and unique, as it was when it anchored one end of the ancient Silk Road. It is the best option for acmodating industrial transfers from East China or the world at large, he said on Wednesday in Xi39。s business development. Rudy Buttignol, president of the public broadcasting pany in British Columbia, Canada, said his work requires frequent travel to Chengdu and the policy makes the trips easier. Data from the city39。s largest breeding and research center. Three days are long enough for foreign visitors to visit those iconic tourist spots, he noted. The city is home to the remains of the Jin sha civilization that dates back more than 3,000 years as well as the Qing cheng Mountains and the Du jiang yan irrigation system. Qing cheng has long been recognized a s the birthplace of Taoism, China39。s 72hour visafree policy has attracted wide attention from both Chinese and foreign experts and businessmen since it took effect on Sept 1 last year. The program permits citizens from 51 countries and regions including the United States, Australia, Canada and Japan who have valid visas and flight tickets to a third country to spend three days in the city. The capital of Sichuan province is the first city in the western region of China to offer foreign tourists a threeday visa and the fourth nationwide to adopt the policy following Shanghai, Beijing and Guangzhou. Li Zhiyong, deputy dean of the tourism institute at Sichuan University, said the move contributes to a large increase in the number of overseas tourists and raises the city39。//電機(jī)停止 if(tt==16) tt=0。 if(tt==2) shake=0。//電機(jī)動(dòng) if(t==15)shake=0。//電機(jī)動(dòng) if(t==5)shake=0。 shake=1。 timeflag=0。 while(key4==0)。 } } } key4=1。 shakeflag=1。//確定定時(shí) distime()。 if(key1==0) {ddelay(2)。 if(settime==00) settime=59。 while(key3==0)。 } key3=1。 settime++。 if(key2==0) { ddelay(2)。 WriteCommandLCM(0x0c,1)。 if(key1==0) { ddelay(2)。key4=1。key2=1。0x0f)?5:0。0xf0)4。 temp1=temp14。readBTS()。readBTS()。readBTS()。 //讀一字節(jié) temp1=readBTS()。 //忽略 ROM 匹配 writeBTS(0xbe)。 resetTS()。 //忽略 ROM 匹配 writeBTS(0x44)。測(cè)溫子程序流程如圖 20 所示: 開始 設(shè)置DQ=1 復(fù)位 DS18B20 圖 20 測(cè)溫子程序流程圖 測(cè)溫子程序如下: void gettempTS(void) //讀取測(cè)得的環(huán)境溫度 { resetTS()。由于 DS18B20 工作在單總線方式 ,數(shù)據(jù)的讀寫都占用同一根線 ,所以每種操作都必須嚴(yán)格按照時(shí)序進(jìn) 行。 //數(shù)組指針遞增 X++。 // X 的變化范圍 0~15 while(X=15) //X=15 時(shí)進(jìn)入 while 語句循環(huán) { //while 語句開始 DisplayOneChar(X,Y,DData[ListLength])。 // Y 的變化范圍 0~1 Xamp。 //定義 ListLength 為無符號(hào)字符型變量,并賦初值為 0 Yamp。 } } //外部中斷處理函數(shù) void ex0(void) interrupt 0 { waterflag=1。 shakeflag=1。 } //聲音檢測(cè)處理 ,啟動(dòng)定時(shí)器,搖動(dòng) if(soundflag==1) { if(timeflag==0) { timeflag=1。 beep=1。 ddelay(200)。 ddelay(200)。 ddelay(200)。waterflag=0。} keyscan()。shake=1。 sec==00) { timeflag=0。 settime==00 amp。 //定時(shí)時(shí)間到,停止處理 if(timeflag==1 amp。 while(1) { keyscan()。 beep=1。 ddelay(200)。 DisplayListChar(0,1,str1)。 //外部中斷 WriteCommandLCM(0x0c,1)。 EX0=1。 /*延時(shí)大約 40Ms,等待外設(shè)準(zhǔn)備好 */ Initime()。 beep=0。 主程序模塊設(shè)計(jì) 系統(tǒng)主程序?qū)崿F(xiàn)了定時(shí)設(shè)置、電機(jī)驅(qū)動(dòng)、狀態(tài)顯示、報(bào)警和音樂播放等控制功能。 表 4 P3 端口引腳與復(fù)用功能表 端口引腳 復(fù)用功能 RXD(串行輸入口) TXD(串行輸出口) INT0(外部中斷 0) INT1(外部中斷 1) T0(定時(shí)器 0 的外部輸入) T1(定時(shí)器 1 的外部輸入) WR(外部數(shù)據(jù)存儲(chǔ)器寫選通) RD(外部數(shù)據(jù)存儲(chǔ)器讀選通) 多功能嬰兒搖籃控制模塊的硬件系統(tǒng)總體電路原路圖如圖 19所示。 表 3 P1 口管腳 復(fù)用功能 端口引腳 復(fù)用功能 T2(定時(shí)器 /計(jì)算器 2 的外部輸入端) T2EX(定時(shí)器 /計(jì)算器 2 的外部觸發(fā)端和雙向控制) MOSI(用于在線編程) MISO(用于在線編程) SCK(用于在線編程) 在 AT89S52 中,同樣 P3 口還用于一些復(fù)用功能,如表 4 所列。每根線可以單獨(dú)用作輸入或輸出。 圖 18 AT89S52 引腳圖 按照功能, AT89S52 的引腳可分為主電源、外接晶體振蕩或振蕩器、多功能 I/O 口、控制和復(fù)位等。另外, AT89S52 具有如下特點(diǎn): 40個(gè)引腳, 8k Bytes Flash 片內(nèi)程序存儲(chǔ)器, 256 bytes 的隨機(jī)存取數(shù)據(jù)存儲(chǔ)器( RAM), 32個(gè)外部雙向輸入 /輸出( I/O)口, 5個(gè)中斷優(yōu)先級(jí) 2 層中斷嵌套中斷, 2個(gè) 16位可編程定時(shí)計(jì)數(shù)器 ,2個(gè)全雙工串行通信口,看 門狗( WDT)電路,片內(nèi)時(shí)鐘振蕩器。掉電保護(hù)方式下, RAM 內(nèi)容被保存,振蕩器被凍結(jié),單片機(jī)一切工作停止,直到下一個(gè)中斷或硬件復(fù) 位為止。 AT89S52 可降至 0Hz 靜態(tài)邏輯操作,支持 2 種軟件可選擇節(jié)電模式。片上 Flash 允許程序存儲(chǔ)器在系統(tǒng)可編程,亦適于常規(guī)編程器。 AT89S52 是一種低功耗、高性能 CMOS8 位微控制器,具有 8K在系統(tǒng)可編程 Flash 存儲(chǔ)器,典型的結(jié)構(gòu)如圖 17 所示。 圖 16 報(bào)警電路 主控單片機(jī) 系統(tǒng)的主控部分采用單片機(jī) AT89S52。另外,蜂鳴器不僅用于報(bào)警,還用來在搖籃擺動(dòng)時(shí)播放催眠曲。 圖 15 電機(jī)驅(qū)動(dòng)電路 報(bào)警電路 報(bào)警電路由單片機(jī)驅(qū)動(dòng)蜂鳴器組成,與電機(jī)驅(qū)動(dòng)電路類似,如圖 16 所示,同樣采用三極管 8550構(gòu)成電流放大電路,驅(qū)動(dòng)蜂鳴器。本文采用的三極管 8550 是一種低電壓 , 大電流 , 小信號(hào)的 PNP 型硅三極管 ,放大系數(shù)約為 150,放大后的電機(jī)驅(qū)動(dòng)電流可達(dá)到 2A 左右。 鍵盤共有四個(gè)按鍵 ,按鍵 S1 用來確定定時(shí)操作,用于確定定時(shí)操作的開始和結(jié)束;按鍵 S2 和 S3 分別 用來對(duì)定時(shí)時(shí)間進(jìn)行加 1 和減 1 操作;按鍵 S4用來取消定時(shí),此時(shí)搖籃啟動(dòng)后將一直擺動(dòng)。該系統(tǒng)的鍵盤設(shè)計(jì)是采用掃描方式實(shí)現(xiàn)的矩陣鍵盤。在定時(shí)設(shè)置工作狀態(tài)下,第一行顯示的是所設(shè)定的擺動(dòng)時(shí)間;當(dāng)嬰兒尿床時(shí),在報(bào)警的同時(shí),液晶屏第二行溫度顯示后面會(huì)顯示“ WET”字樣,以表明嬰兒尿床的狀態(tài)。 C,那么 LCD的第二行就會(huì)顯示“ 176。 下面是 1602 液晶模塊的一些主要技術(shù)參數(shù): ⑴ 邏輯工作電壓 ( VDD): +~ +;