【正文】
在確定系統(tǒng)電路中有波形輸出且是近似 38KHz 的方波輸出后,就很明確的說(shuō)明紅外載波生成部分是正常運(yùn)行的。逐一的對(duì) 10 個(gè)按鍵進(jìn)行測(cè)試,期間也不時(shí)使用復(fù)位鍵,同時(shí)再次檢測(cè)復(fù)位功能。 圖如附錄 4。 按鍵控制調(diào)試 檢測(cè)按鍵是否能正常工作,通過(guò)對(duì)數(shù)碼管的控制來(lái)達(dá)到檢測(cè)的目的。 接著 用萬(wàn)用 表 在芯片和個(gè)管腳間逐一測(cè)試。為簡(jiǎn)單起見(jiàn),在實(shí)際測(cè)試過(guò)程 中,其實(shí)只需要測(cè)試硬件部分電路的收發(fā)就可以達(dá)到測(cè)試的目的了。 //使能接收 ES=1。 a=256921600/(16*baud)。 想要再接收,必須再用指令清零。 串行口控制寄存器 SCON SCON 寄存器用來(lái)控制串行口的工作方式和狀態(tài),它可以是位尋址。 delay(5)。 w3=0。 w1=1。 if(rxbuf15)rxbuf=15。 } for(i=0。 OUT1VCC3G N D2I C 1L T 1 83 8R210 kR310 kR42. 2kR110V C CC210 4C110 uFV C CR X DT590 15 本系統(tǒng)的控制功能主要包括發(fā)射端的鍵盤(pán)按鍵輸入,按鍵信息的編碼輸出,接收端的譯碼顯示等功能。用以產(chǎn)生 38KHz的脈沖載波信號(hào);發(fā)射管選用的是紅外二極管,用來(lái)向外發(fā)射 950nm的紅外光束。 紅外線(xiàn) 通信 是利用紅外線(xiàn)發(fā)光 LED 發(fā)射波長(zhǎng) 950nm 近紅外波段的紅外線(xiàn)不可見(jiàn)光來(lái)發(fā)送信號(hào)。直射式指發(fā)光管和接收管相對(duì)安放在發(fā)射與受控物的兩端,中間相距一定距離;反射式指發(fā)光管和接收管并列一起,平時(shí)接收管始終無(wú)光照,只在發(fā)光管發(fā)出的紅外光遇到反射物時(shí),接收管收到反射回來(lái)的紅外線(xiàn)才工作。輸出端為 F ,另外還有集電極開(kāi)路的放電管 DIS。 ( 6) Pin 6 (重置鎖定): 重置鎖定并使輸出呈低態(tài)。觸發(fā)信號(hào)上緣電壓須大于 2/3 VCC,下緣須低于 1/3 VCC。 NE555 屬于 CMOS 工藝制造,圖 32 所示是 NE555 的外形圖。在由外部程序存儲(chǔ)器取指期間,每個(gè)機(jī)器周期兩次 /PSEN 有效。在平時(shí) , ALE 端以不變的頻率 周期輸出正脈沖信號(hào),此頻率為振蕩器頻率的 1/6。 P3 口: P3 口管腳是 8 個(gè)帶內(nèi)部上拉電阻的雙向 I/O 口,可接收輸出 4 個(gè) TTL 門(mén)電流。 P1 口管腳寫(xiě)入 1 后,被內(nèi)部上拉為高,可用作輸入, P1 口被外部下拉為低電平時(shí),將輸出電流,這是由于內(nèi)部上拉的緣故。 圖 31 AT89S52管腳圖 單片機(jī)的主要特性 ( 1)兼容 MCS51 系列產(chǎn)品; ( 2) 8KB 的在系統(tǒng)可編程 Flash ROM,可以達(dá)到 1000 次擦寫(xiě)周期; ( 3) ~ 的工作電壓; ( 4)全靜態(tài)操作: 0~33MHz; ( 5)三態(tài)存儲(chǔ)器鎖定; ( 6) 256*8b 內(nèi)部 RAM; ( 7) 32 個(gè)可編程 I/O 口; ( 8)三個(gè)可編程定時(shí)、計(jì)數(shù)器; ( 9) 8 個(gè)中斷源; ( 10)全雙工串行口; ( 11)可節(jié)省電能的省電及掉電模式; ( 12)掉電模式可由中斷喚醒; ( 13)看門(mén)狗定時(shí)器; ( 14)雙數(shù)據(jù)指針; ( 15)具有掉電標(biāo)志。在任一時(shí)刻,只需要一種 振蕩 電路便能使單片機(jī)正常工作。 其中 ~ 為段碼驅(qū)動(dòng)端, ~ 為位碼驅(qū)動(dòng) 端,缺省時(shí)顯示 0。數(shù)碼管 顯示器的顯示方法有靜態(tài)和動(dòng)態(tài)兩種方法。 紅外接收電路主要元器件 是一種集紅外線(xiàn)接收、放大、整形于一體化的紅外接收器 ,在實(shí)際應(yīng)用 中用 來(lái)接收 950nm的紅外光束。 圖 21 NE555構(gòu)成的 38KHz振蕩電路圖 T R I G2Q3R4CVolt5T H R6D I S7VCC8GND1I C 255 5AR 103. 9kC62. 2n FC710 3C310 4C422 uFV C CR 111kR89. 2kV C CR91M 本系統(tǒng) 采用的是方案 2的設(shè)計(jì),用硬件電路產(chǎn)生 載波 , 即便在原理上多些研究也要避免程序編譯的不 熟悉 和繁雜。 在遇到困難時(shí),可以與同學(xué)共同討論解決,也可以尋找老師 幫助 。因此,低噪聲的前置放大器設(shè)計(jì)和自適應(yīng)的碼元判決電路是必須的。 該 系統(tǒng)中有發(fā)射模塊、接收模塊、顯示模塊、按鍵模塊等。紅外線(xiàn)一體化接收頭是集紅外接收、放大、濾波和比較器輸出等的模塊,性能穩(wěn)定、可靠。一般有透明、黑色和深藍(lán)色等三種。紅外數(shù)據(jù)傳輸一般采用紅外波段內(nèi)的近紅外線(xiàn),波長(zhǎng)在 ~25μm。 關(guān)鍵詞: 單片機(jī);紅外通信; 紅外 發(fā)射; 紅外 接收 Abstract In many practical SCM system, often using nonelectrical signals (such as optical signals, ultrasonic signals, etc.) to transmit control information and data information in order to achieve control functions, including infrared munication is the most widely used means of a munication control. Because the infrared ray munication has the characteristics of the physical volume small, the power consumes low, the function is strong, the cost low, and so on. As a result, after color television, video recorder, equipping in the other small scaled electric appliances such as tape recorder, stereo set equipments, the air condition machine and toy etc. are also adopt the infrared ray munication technique in succession. In the industry equipments , in the environment of the high pressure, radiation, poisonous air, dust and so on, adoption infrared ray munication technique not only plete credibility and can insulate the electricity interference availably. And the microcontroller is the device that uses extensively in the designs application currently ,it can attain the different result by the software pile ,carrying out different kinds of functions, have advantages of good dexterity, high credibility ,can expand good and so on. This text wants to introduce a way how to fabricate a simple system of infrared ray munication use of the microcontroller, bining a infrared device, so that it can achieve the function how to municate for the infrared ray in a short distance. Different from the general Infrared remote controller, it is not use the special coding and decoding chip to realize the codes and the decodes in the part of the sends and receives, but uses the C51 Microcontroller, through the programs of codes and decodes of the Microcontroller, so that realizes infrared signal sending and receiving, thus realizes the munication function