【正文】
*********手動(dòng)時(shí)鐘調(diào)整*************/void hand_time_adjust(void){……}/*************任意城市時(shí)鐘***************/void any_city_time(void){int addl,addh,add_in_temp。Delay(50)。for(j=0。dis_time()。 add_in_temp=35。 I2C_time[5]=ASC2BCD(mon_H,mon_L)。0x00ff)。 } if(key_value==18) { if(read_enable==1) { read_enable=0。 FM25CL256_Read(add_in_temp,16,city_n)。 EI2C=0。=0x3f。 } else if(city_offset_temp==1) time_temp[2]=time_temp[2]+city_data+city_data_temp。 Send_DAT(39。 LCD_GB(tab,1)。 39。 Send_DAT(39。 Send_DAT(sec_H)。 } if(key_value==15) { key_value=18。amp。既糾結(jié)了自己,又打擾了別人。用一些事情,總會(huì)看清一些人。amp。 39。:39。 Send_DAT(hour_H)。)。 Send_DAT(mon_H)。239。 } if(city_offset==1) { if(city_offset_temp==1) time_temp[2]=time_temp[2]city_data+city_data_temp。=0x3f。 do {rture=IRcvStr(0xa2,0x02,I2C_time,7)。j16。} while(!wture)。 city_data=city_data_temp。 I2C_time[2]=ASC2BCD(hour_H,hour_L)。 if(add_in_temp7385) add_in_temp=0。EI2C=0。FM25CL256_Read(add_in,16,city_n)。city_offset_temp=city_offset。 } else { GPS_Data_Point=GPS_Data_Point+1。) { GPS_Data[GPS_Data_Point]=S0BUF。 case 4: if(S0BUF==39。 } else { GPS_Data_Point=0。) { GPS_Data[GPS_Data_Point]=S0BUF。 switch(GPS_Data_Point) { case 0: if(S0BUF==39。 EI2C=0。 } if (sendRQ) { signs=1。} while(!wture)。039。 else I2C_temp[2]=I2C_temp[2]+8city_data。*39。addl=(int)(Read_Word(0x1CFD))。EX1=1。IP0=0。本設(shè)計(jì)的應(yīng)用范圍比較廣泛,在各個(gè)對(duì)時(shí)間精度要求高或?qū)r(shí)間同步性要求高的有所需求的行業(yè)使用。而拖芯片的方法大大縮短了焊接用時(shí),電路板的焊接只用了三四個(gè)小時(shí)。在沒(méi)有仿真器的系統(tǒng)中,器件的調(diào)試都為盲調(diào)。這種拖芯片的工藝在南方的工廠里應(yīng)用非常廣泛,在北方比較少見(jiàn)。在焊接芯片時(shí)我使用了一種更為快捷的焊接工藝——拖芯片工藝。在生成PCB時(shí),電源和地的導(dǎo)線應(yīng)大于18mil,普通導(dǎo)線應(yīng)大于12mil。在印制電路板設(shè)計(jì)中,按照以下步驟,完成了印制電路板的制作。所以在這里不便陳述。存到單片機(jī)的內(nèi)存中。每一個(gè)按鍵都有唯一的鍵值,當(dāng)函數(shù)查詢到的鍵值與某個(gè)函數(shù)的入口吻合時(shí),就進(jìn)入相應(yīng)的函數(shù)。為零則跳出函數(shù),不去掃描鍵盤(pán)。 //清除按鍵標(biāo)志位 ReadKey()。圖8主程序框圖 GPS報(bào)文接收程序設(shè)計(jì)由于GPS模塊輸出的所有報(bào)文都為ASCII碼,而且每一個(gè)報(bào)文行都以$開(kāi)始,其后緊跟報(bào)文行的關(guān)鍵字,最后以*結(jié)束本行。首先要確定系統(tǒng)所要實(shí)現(xiàn)的功能和代碼執(zhí)行的方式。圖7 鍵盤(pán)電路顯示模塊采用金鵬公司的OCMJ48C,該模塊采用ST7920芯片,內(nèi)建中文字庫(kù),支持三種控制接口,分別是8位微處理器接口,4位微處理器接口及串行接口。鍵盤(pán)中斷功能主要用于當(dāng)P0口等于或不等于特定的模式時(shí)產(chǎn)生一個(gè)中斷。這樣就可以加一個(gè)或非門(mén)讓中斷管腳作方波輸出的開(kāi)關(guān)。I2C總線接口定義要求在SDA和SCL線上各加一個(gè)上拉電阻。時(shí)鐘芯片采用了飛利浦公司生產(chǎn)的PCF8563芯片,PCF8563是低功耗的CMOS 實(shí)時(shí)時(shí)鐘/日歷芯片,它提供一個(gè)可編程時(shí)鐘輸出,一個(gè)中斷輸出和掉電檢測(cè)器,所有的地址和數(shù)據(jù)通過(guò)I2C總線接口串行傳遞。與EEPROM不同,F(xiàn)M25CL256以SPI總線進(jìn)行寫(xiě)操作,操作無(wú)須延時(shí)。圖4 電源電路 GPS模塊電路設(shè)計(jì)GPS模塊采用臺(tái)灣HOLUX公司的GR85模塊。而且SPX3819還具有反向電池保護(hù)、反饋電流限制和負(fù)載掉電保護(hù)等功能[4]。圖2 ICP在電路編程接口定義圖3 JTAG在線調(diào)試接口定義 ICP是一種串行編程方式,其通過(guò)一根時(shí)鐘線與一根數(shù)據(jù)線串行傳輸編程指令及數(shù)據(jù)。端口“輸入模式匹配”檢測(cè)。它采用了高性能的處理器結(jié)構(gòu),指令執(zhí)行時(shí)間只需2到4個(gè)時(shí)鐘周期。GPS模塊通過(guò)天線接收多顆衛(wèi)星傳來(lái)的定位及時(shí)間數(shù)據(jù),通過(guò)串口以TTL232電平將數(shù)據(jù)送出,并產(chǎn)生1PPS秒脈沖。鐵電存儲(chǔ)采用串行SPI總線進(jìn)行高達(dá)3Mb/s的速率讀寫(xiě)。系統(tǒng)內(nèi)要自帶一個(gè)實(shí)時(shí)運(yùn)行的時(shí)鐘。時(shí)鐘在沒(méi)有接收到準(zhǔn)確的GPS報(bào)文的情況下還可以通過(guò)鍵盤(pán)對(duì)時(shí)鐘進(jìn)行手動(dòng)調(diào)整。通常,可以用原子鐘來(lái)保證儀器的時(shí)間與國(guó)標(biāo)時(shí)間達(dá)到精確同步,但是原子鐘價(jià)格昂貴。但是,眾所周知,計(jì)算機(jī)時(shí)鐘的守時(shí)性能并不出色。.. .. .. ..學(xué)士學(xué)位畢業(yè)設(shè)計(jì)(論文)基于單片機(jī)的GPS高精度授時(shí)時(shí)鐘設(shè)計(jì)學(xué)生姓名:指導(dǎo)教師:所在學(xué)院:專 業(yè):農(nóng)業(yè)電氣化摘要本文設(shè)計(jì)了一種基于P89LPC952高速單片機(jī)的GPS衛(wèi)星授時(shí)時(shí)鐘。關(guān)鍵詞:授時(shí)時(shí)鐘 P89LPC952 GPS 中央處理單元.. .. .. ..ABSTRACTA kind of GPS satellite timing clock based on the P89LPC952 Highspeed MCU is remended in the following thesis. It is posed of receptors、central proceeding sections, LCM, keyboard and output connectors. The central proceeding section could deal with the data to make the output time data by use of the standard time signals supplied by receptors, thus, keeping highly precision timing. By this way, not only solve the problem of the time obtained, but also the time in the worldwide is really pletely unified. Even more, creatively integrates 212 cities of the world wide’s realtime display. Compared with conventional method, this new synchronous clock plan has many advantages, such as simple, high precision, wide extension, no channels needed, no confine of geography and weather environment and so on. It is the ideal way to synchronize the clock. In the following paper, represent the hardware of the GPS timi