【正文】
大 連 海 事 大 學 畢 業(yè) 論 文 二〇一四年六月 ┊┊┊┊┊裝┊┊┊┊┊┊┊訂┊┊┊┊┊┊線┊┊┊┊┊ 基于單片機的紅外光通信系統(tǒng)設計 (接收部分) 專業(yè)班級: 電子信息工程 4 班 姓 名: 王 強 指導教師: 譚克俊 信息科學技術學院 I 摘 要 紅外光通信是以紅外線為載體傳輸數(shù)字信號,適合于低成本、點對點的高速率數(shù)據(jù)互聯(lián),尤其適合應用于嵌入式系統(tǒng)、移動設備等領域。本設計主要是針對紅外光傳輸?shù)臄?shù)字信號進行處理,將其攜帶 的數(shù)字信息接收并轉換成語音信號和溫度信號,通過負載喇叭播放語音并由顯示屏顯示溫度。 本設計包括紅外信號接收、單片機處理、濾波電路、信號調理、功率放大、液晶顯示以及中繼轉發(fā)模塊。首先通過紅外接收傳感器 RPM882H7 接收發(fā)射部分所發(fā)射的信號;其次,將接收的信號進行處理。根據(jù)發(fā)射部分是將數(shù)字信號以串行方式輸出并驅動紅外發(fā)射管發(fā)光,高電平點亮發(fā)光管、低電平熄滅的原理,本設計利用單片機的外部中斷捕捉信號的跳變沿,將接收的信號恢復成串行數(shù)字信號;然后,將串行信號送給單片機的串口接收端,從單片機串口數(shù)據(jù)寄存器中得到經(jīng) 過 PCM 編碼后的語音信號和溫度信號的電壓值,通過處理減小傳輸過程中噪聲的干擾,再由單片機判斷信號類型,是語音信號則送給單片機內部 DAC 進行數(shù) /模轉換,溫度信號輸送給顯示屏直接顯示;最后, DAC 輸出的波形再經(jīng)過帶通濾波器平滑濾波,濾出發(fā)射部分采集的語音信號,輸送給音頻功率放大電路,通過負載喇叭即可聽到傳輸過來的聲音。 本設計在 STM32F103ZET6 單片機硬件平臺下,通過 C 語言設計程序,并借助RVMDK 軟件開發(fā)環(huán)境進行調試,實現(xiàn)了基于單片機系統(tǒng)的紅外接收裝置。接收發(fā)射部分的信息,在 115200 波特率下通信距 離達到兩米左右;具有在傳輸不暢情況下指示燈提示功能;能通過液晶屏顯示溫度,具有良好人機交互界面;從負載喇叭上得到了較好的語音效果。 關鍵詞:紅外光接收;串口通信; STM32 單片機;數(shù)模轉換 II ABSTRACT Infrared munication is based on infrared carrier to transmit digital signals, suitable for lowcost, pointtopoint and highspeed data connection, it particularly suitable for applications for mobile devices, embedded systems and other fields. This design is mainly based on digital signal which is transmitted by infrared light to process, digital information will be the received and converted into the speech signal and the temperature signal, the voice can be heard by the speaker loaded in the end of the design and the temperature will be showed on the screen. This design includes the infrared signal receiving, MCU processing, filter circuit, signal conversion, power amplification, liquid crystal display and relay module. Firstly getting the infrared signal, receive digital signal from the infrared receiving sensor RPM882H7。 secondly, the signals will be processed and According to the emission part send the digital signal into serial mode and drive the infrared light working, high level light the infrared emitting on, low level put out it, the MCU of the design use it’s external interrupt testing signal jump edge, converted it into the serial signal。 then, the signal converted will be send to the MCU’s serial port, getting the voltage data of the voice signals and the temperature signals PCM encoded value from the serial port data register, after treatment to reduce the interference noise in the transmission process, the MCU can judgment the signals’ types, and the speech signal will be sent to the internal DA converter, the temperature signal will be sent to the display screen to display。 finally, the waveform output from the DAC can be send through the bandpass filters to filter, then getting the voice signal of the sending end, and transport it to the audio power amplifying circuit, form the loudspeaker the voice signal transmitted by the infrared can be heard. With the STM32F103ZET6 hardware platform, through the C language program design, and using RVMDK software development environment for debugging, this design realized the infrared receiving device based on MCU system. Receiving information of the transmission part, munication distance can up to two meters in the 115200 baud rate。 a lamp show the transmission jam situation。 display the temperature through the LCD screen, with good manmachine interface。 get better audio effect from the load on the trumpet. Keywords: Infrared receiving, serial munication, STM32 MCU, digital to analog conversion III 目 錄 第 1 章 緒論 ...................................................... 1 紅外通信技術的國內外發(fā)展及研究現(xiàn)狀 ........................ 1 本文主要工作 .............................................. 2 第 2 章 系統(tǒng)總體方案 .............................................. 3 紅外光通信系統(tǒng)介紹 ........................................ 3 總體方案設計 .............................................. 3 第 3 章 系統(tǒng)模塊設計 .............................................. 5 紅外接收模塊設計 .......................................... 5 STM32 單片機處理模塊設計 .................................. 6 STM32 單片機中斷系統(tǒng) ................................. 8 STM32 單片機串口通信 ................................. 8 STM32 單片機 DAC .................................... 11 STM32 單片機定時器 .................................. 12 濾波電路模塊設計 ......................................... 13 高通濾波器設計 ..................................... 13 低通濾波器設計 ..................................... 14 信號調理模塊設計 ......................................... 15 功率放大模塊 ............................................. 15 液晶顯示模塊設計 ......................................... 16 紅外通信中繼模塊設計 ..................................... 17 紅外發(fā)射電路設計 ................................... 17 紅外通信中繼電源設計 ............................... 18 第 4 章 系統(tǒng)軟件設計 ............................................. 20 軟件開發(fā)環(huán)境簡介 ......................................... 20 程序流程設計 ............................................. 21 系統(tǒng)初始化 ......................................... 22 中斷函數(shù)配置 ....................................... 22 DAC 控制 ............................................ 23 LCD 顯示 ............................................ 23 STM32 程序下載 ........................................... 24 第 5 章 系統(tǒng)測試 ................................................. 25 電路硬件整體檢測 ......................................... 25 紅外接收模塊測試 ......................................... 26 濾波電路測試 ......................................