2012“TI”杯電子設(shè)計(jì)競(jìng)賽D題聲音定位系統(tǒng)設(shè)計(jì)報(bào)告.docx
《2012“TI”杯電子設(shè)計(jì)競(jìng)賽D題聲音定位系統(tǒng)設(shè)計(jì)報(bào)告.docx》由會(huì)員分享,可在線(xiàn)閱讀,更多相關(guān)《2012“TI”杯電子設(shè)計(jì)競(jìng)賽D題聲音定位系統(tǒng)設(shè)計(jì)報(bào)告.docx(70頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
2012年“TI”杯四川省電子設(shè)計(jì)競(jìng)賽 聲音定位系統(tǒng)(D題) 競(jìng)賽選題: 聲音定位系統(tǒng)(D題) 學(xué) 校: 西南石油大學(xué) 參賽隊(duì)員:楊 杰 劉德雄 康 敏 摘 要 本設(shè)計(jì)采用TI公司生產(chǎn)的超低功耗單片機(jī)MSP430G2452和G2553分別作為定位系統(tǒng)的聲源產(chǎn)生模塊和信息處理模塊,實(shí)現(xiàn)了聲音信號(hào)的發(fā)生、信號(hào)收集處理和屏幕顯示以及語(yǔ)音提示等功能。該設(shè)計(jì)采用2節(jié)家用1.5V電池供電,實(shí)現(xiàn)了低功耗狀況下的聲音定位系。聲源接收單元信號(hào)反應(yīng)靈敏,能較準(zhǔn)確的得到信號(hào)并及時(shí)傳送到信號(hào)處理單元。以MSP430為主的Launchpad也符合了低功耗的標(biāo)準(zhǔn),并且可以實(shí)現(xiàn)信號(hào)的運(yùn)算處理以及控制LCD液晶屏幕顯示測(cè)試數(shù)據(jù)。在定位算法上采用的是歸一正方形算法。通過(guò)調(diào)試修正以后,能實(shí)現(xiàn)基本的聲源定位并顯示。 關(guān)鍵詞:聲音定位 低功耗 MSP430 目 錄 一.引言……………………………………………………………………………3 1.1主要任務(wù)………………………………………………………………………3 1.2設(shè)計(jì)要求………………………………………………………………………4 二.方案設(shè)計(jì)與論證………………………………………………………………4 2.1方案對(duì)比………………………………………………………………………4 2.1.1 聲源模塊……………………………………………………………………5 2.1.2 接收模塊放大芯片…………………………………………………………5 2.1.3 單片機(jī)MCU…………………………………………………………………6 2.1.4 顯示模塊……………………………………………………………………7 2.1.5 定位算法選擇………………………………………………………………8 三.硬件電路設(shè)計(jì)…………………………………………………………………9 3.1 系統(tǒng)框圖………………………………………………………………………9 3.2聲響模塊………………………………………………………………………10 3.3 從單片機(jī)最小系統(tǒng)……………………………………………………………10 3.4聲音接收模塊…………………………………………………………………11 3.5信號(hào)處理模塊…………………………………………………………………12 3.6 語(yǔ)音模塊………………………………………………………………………12 四. 軟件設(shè)計(jì)………………………………………………………………………12 4.1 軟件流程圖……………………………………………………………………13 五.測(cè)試結(jié)果與分析………………………………………………………………14 5.1 測(cè)試方法與儀器………………………………………………………………15 5.2 測(cè)試數(shù)據(jù)………………………………………………………………………15 5.3 測(cè)試結(jié)果分析…………………………………………………………………15 5.4 測(cè)試結(jié)果………………………………………………………………………15 參考文獻(xiàn)……………………………………………………………………………16 附錄一:……………………………………………………………………………17 附錄二:……………………………………………………………………………18 附錄三:……………………………………………………………………………19 一、引言 1.1主要任務(wù) 設(shè)計(jì)一套聲音定位系統(tǒng)。在一塊不大于1m2的平板上貼一張500mm350mm的坐標(biāo)紙,在其四角外側(cè)分別固定安裝一個(gè)聲音接收模塊,聲音接收模塊通過(guò)導(dǎo)線(xiàn)將聲音信號(hào)傳輸?shù)叫畔⑻幚砟K,聲音定位系統(tǒng)根據(jù)聲響模塊通過(guò)空氣傳播到各聲音接收模塊的聲音信號(hào),判定聲響模塊所在的位置坐標(biāo)。系統(tǒng)結(jié)構(gòu)示意圖如圖1所示。 圖1 聲音定位系統(tǒng)結(jié)構(gòu)示意圖 1.2設(shè)計(jì)要求 【1】. 基本要求 (1) 設(shè)計(jì)制作一個(gè)聲響模塊,含信號(hào)產(chǎn)生電路、放大電路和微型揚(yáng)聲器等,每按鍵一次發(fā)聲一次,聲音信號(hào)的基波頻率為500Hz左右,聲音持續(xù)時(shí)間約為1s。要求聲響模塊采用3V以下電池供電,功耗不大于200mW。 (2) 設(shè)計(jì)制作四路聲音接收模塊,由麥克風(fēng)、放大電路等組成,并分別與信息處理模塊相連接,以便將頻率為500Hz左右的信號(hào)傳送至信息處理模塊。 (3) 設(shè)計(jì)制作一個(gè)信息處理模塊,要求該模塊能根據(jù)從聲音接收模塊傳來(lái)的信號(hào)判斷聲響模塊所在位置的x、y坐標(biāo),并以數(shù)字形式顯示x、y坐標(biāo)值,位置坐標(biāo)值誤差的絕對(duì)值不大于30mm。 【2】. 發(fā)揮部分 (1) 改善接收信號(hào)的放大電路性能,改進(jìn)算法,進(jìn)一步提高定位精度。 (2) 控制聲響模塊以不間斷的連續(xù)周期波的形式發(fā)出聲音信號(hào),其基波頻率為500Hz左右。當(dāng)聲響模塊在坐標(biāo)紙上移動(dòng)時(shí),聲音定位系統(tǒng)能連續(xù)跟蹤顯示聲響模塊的x、y坐標(biāo)值,隨機(jī)停止聲響模塊的移動(dòng),能立即穩(wěn)定地顯示聲響模塊的x、y坐標(biāo)值,誤差的絕對(duì)值不大于10mm。 (3) 具有顯示聲響模塊移動(dòng)軌跡的功能。當(dāng)聲響模塊在坐標(biāo)紙上按指定路徑移動(dòng)時(shí),液晶顯示屏能動(dòng)態(tài)顯示聲響模塊移動(dòng)的軌跡,顯示的軌跡與聲響模塊移動(dòng)的路徑一致。 (4) 其它。 二. 方案設(shè)計(jì)與論證 2.1方案對(duì)比 本設(shè)計(jì)分以下幾個(gè)模塊組成:聲響模塊、聲音接受模塊、信號(hào)處理模塊?,F(xiàn)對(duì)模塊的選用方案進(jìn)行論證。 2.1.1 聲源模塊 設(shè)計(jì)要求聲響模塊采用3V以下電池供電,功耗不大于200mW。 方案一:有源蜂鳴器 蜂鳴器是一種一體化結(jié)構(gòu)的電子訊響器,采用直流電壓供電,廣泛應(yīng)用于計(jì)算機(jī)、打印機(jī)、復(fù)印機(jī)、報(bào)警器、電子玩具、汽車(chē)電子設(shè)備、電話(huà)機(jī)、定時(shí)器等電子產(chǎn)品中作發(fā)聲器件。 方案二:無(wú)源蜂鳴器 有源和無(wú)源的區(qū)別:這里的“源”不是指電源。而是指震蕩源。也就是說(shuō),有源蜂鳴器內(nèi)部帶震蕩源,所以只要一通電就會(huì)叫。而無(wú)源內(nèi)部不帶震蕩源,所以如果用直流信號(hào)無(wú)法令其鳴叫。必須用2K~5K的方波去驅(qū)動(dòng)它。有源蜂鳴器往往比無(wú)源的貴,就是因?yàn)槔锩娑鄠€(gè)震蕩電路。 方案三:喇叭 8歐0.5瓦喇叭價(jià)格實(shí)惠,聲音響亮,聲音純度較高,并且完全滿(mǎn)足本次設(shè)計(jì)的需求,故本次采用的是喇叭作為發(fā)聲源。 綜上所述,選取便宜可控的喇叭更符合設(shè)計(jì)需要。 2.1.2 接收模塊放大芯片 方案一:LM358 LM358 內(nèi)部包括有兩個(gè)獨(dú)立的、高增益、內(nèi)部頻率補(bǔ)償?shù)碾p運(yùn)算放大器,適合于電源電壓范圍很寬的單電源使用,也適用于雙電源工作模式,在推薦的工作條件下,電源電流與電源電壓無(wú)關(guān)。它的使用范圍包括傳感放大器、直流增益模塊和其他所有可用單電源供電的使用運(yùn)算放大器的場(chǎng)合。 圖2 lm358結(jié)構(gòu)圖 方案二:LM368 LM386是美國(guó)國(guó)家半導(dǎo)體公司生產(chǎn)的音頻功率放大器,主要應(yīng)用于低電壓消費(fèi)類(lèi)產(chǎn)品。為使外圍元件最少,電壓增益內(nèi)置為20。但在1腳和8腳之間增加一只外接電阻和電容,便可將電壓增益調(diào)為任意值,直至 200。輸入端以地為參考,同時(shí)輸出端被自動(dòng)偏置到電源電壓的一半,在6V電源電壓下,它的靜態(tài)功耗僅為24mW,使得LM386特別適用于電池供電的場(chǎng)合。 圖3 lm386管腳圖 方案三:LM393 LM393是高增益,寬頻帶器件,象大多數(shù)比較器一樣,如果輸出端到輸入端有寄生電容而產(chǎn)生耦合,則很容易產(chǎn)生振蕩。這種現(xiàn)象僅僅出現(xiàn)在當(dāng)比較器改變狀態(tài)時(shí),輸出電壓過(guò)渡的間隙,電源加旁路濾波并不能解決這個(gè)問(wèn)題,標(biāo)準(zhǔn)PC板的設(shè)計(jì)對(duì)減小輸入—輸出寄生電容耦合是有助的。減小輸入電阻至小于10K將減小反饋信號(hào),而且增加甚至很小的正反饋量(滯回1.0~10mV)能導(dǎo)致快速轉(zhuǎn)換,使得不可能產(chǎn)生由于寄生電容引起的振蕩,除非利用滯后,否則直接插入IC 并在引腳上加上電阻將引起輸入—輸出在很短的轉(zhuǎn)換周期內(nèi)振蕩,如果輸入信號(hào)時(shí)脈沖波形,并且上升和下降時(shí)間相當(dāng)快,則滯回將不需要。 圖4 lm393管腳圖 由于接收信號(hào)微弱,要得到更精準(zhǔn)的聲源信號(hào),選取了工作電源范圍更寬、輸入失調(diào)電壓更小的LM393。 2.1.3 單片機(jī)MCU 方案一:MSP430 MSP430系列單片機(jī)是美國(guó)德州儀器公司(TI)1996年開(kāi)始推向市場(chǎng)的一種16位超低功耗、具有精簡(jiǎn)指令集的混合信號(hào)處理器。稱(chēng)之為混合信號(hào)處理器,是由于其針對(duì)實(shí)際應(yīng)用需求,將多個(gè)不同功能的模擬電路、數(shù)字電路模塊和微處理器集成在一個(gè)芯片上,以提供“單片機(jī)”解決方案。該系列單片機(jī)多應(yīng)用于需要電池供電的便攜式儀器儀表中。 方案二:AT89C51 AT89C51是一種帶4K字節(jié)FLASH存儲(chǔ)器的低電壓、高性能CMOS8位微處理器,俗稱(chēng)單片機(jī)。AT89C2051是一種帶2K字節(jié)閃存可編程可擦除只讀存儲(chǔ)器的單片機(jī)。單片機(jī)的可擦除只讀存儲(chǔ)器可以反復(fù)擦除1000次。該器件采用ATMEL高密度非易失存儲(chǔ)器制造技術(shù)制造,與工業(yè)標(biāo)準(zhǔn)的MCS-51指令集和輸出管腳相兼容。由于將多功能8位CPU和閃爍存儲(chǔ)器組合在單個(gè)芯片中,ATMEL的AT89C51是一種高效微控制器,AT89C2051是它的一種精簡(jiǎn)版本。AT89C51單片機(jī)為很多嵌入式控制系統(tǒng)提供了一種靈活性高且價(jià)廉的方案。 設(shè)計(jì)需要2片MCU,都采用TI公司提供的MSP430G2xxx系列芯片。其中聲源產(chǎn)生模塊選用以MSP430G2452為核心的單片機(jī)最小系統(tǒng);信息處理系統(tǒng)采用MSP430G2553為主的Launchpad作為數(shù)據(jù)處理和顯示模塊控制。 2.1.4 顯示模塊 方案一:LCD12864 LCD12864為帶中文字庫(kù)的128X64 是一種具有4位/8位并行、2線(xiàn)或3線(xiàn)串行多種接口方式,內(nèi)部含有國(guó)標(biāo)一級(jí)、二級(jí)簡(jiǎn)體中文字庫(kù)的點(diǎn)陣圖形液晶顯示模塊。其顯示分辨率為12864, 內(nèi)置8192 個(gè)16*16 點(diǎn)漢字,和128 個(gè)16*8 點(diǎn)ASCII 字符集.利用該模塊靈活的接口方式和簡(jiǎn)單方便的操作指令,可構(gòu)成全中文人機(jī)交互圖形界面??梢燥@示84 行1616 點(diǎn)陣的漢字. 也可完成圖形顯示.低電壓低功耗是其又一顯著特點(diǎn)。由該模塊構(gòu)成的液晶顯示方案與同類(lèi)型的圖形點(diǎn)陣液晶顯示模塊相比,不論硬件電路結(jié)構(gòu)或顯示程序都要簡(jiǎn)潔得多,且該模塊的價(jià)格也略低于相同點(diǎn)陣的圖形液晶模塊。 方案二:LED顯示屏 LED顯示屏:又稱(chēng)電子顯示屏或者飄字屏幕。是由LED點(diǎn)陣列和led pc 面板組成,通過(guò)紅色,藍(lán)色,綠色LED燈的亮滅來(lái)顯示文字、圖片、動(dòng)畫(huà)、視頻,內(nèi)容可以隨時(shí)更換,各部分組件都是模塊化結(jié)構(gòu)的顯示器件。傳統(tǒng)LED顯示屏通常由顯示模塊、控制系統(tǒng)及電源系統(tǒng)組成。顯示模塊由LED燈組成的點(diǎn)陣構(gòu)成,負(fù)責(zé)發(fā)光顯示;控制系統(tǒng)通過(guò)控制相應(yīng)區(qū)域的亮滅,可以讓屏幕顯示文字、圖片、視頻等內(nèi)容,單色、雙色屏主要用來(lái)播放文字的,全彩屏主要是播放動(dòng)畫(huà)的;電源系統(tǒng)負(fù)責(zé)將輸入電壓電流轉(zhuǎn)為顯示屏需要的電壓電流。 本次大賽要求的是128*64以上分辨率的顯示屏,所以選擇LCD12864就能滿(mǎn)足設(shè)計(jì)要求。并且自帶字庫(kù),簡(jiǎn)單方便。故本設(shè)計(jì)采用LCD顯示屏。 2.1.5 定位算法選擇 方案一:直角坐標(biāo)系法 直接采用三個(gè)點(diǎn)定位的方法,利用函數(shù)關(guān)系式算出坐標(biāo)。如圖: 圖5 直角坐標(biāo)系法測(cè)距 根據(jù)距離不同,接收聲源就會(huì)產(chǎn)生時(shí)間差,兩個(gè)時(shí)間差,兩個(gè)變量,故可以求出(x,y)的坐標(biāo)值。 x2+y-352-√(x2+y2)=t1-t2*c √((x-502+y2)- √(x2+y2)=t2-t3*c 其中c=340m/s。這種方法雖然思路簡(jiǎn)單,但是運(yùn)算量大,將會(huì)影響單片機(jī)運(yùn)算速度,增加我們的運(yùn)算難度,故不采用。 方案二:歸一化正方形陣 圖6 歸一化正方形 歸一化正方形算法 如圖,傳感器陣列采用正方形,傳感器的位置坐標(biāo)為(L,L),(-L,L),(-L,-L),(L,-L)。則聲源位置(x,y)可由下式算出(式中2L為正方陣的邊長(zhǎng),Δt1,Δt2,Δt3分別為傳感器2,3,4相對(duì)于1的時(shí)差,c是傳播速度): 三.硬件電路設(shè)計(jì) 3.1 系統(tǒng)框圖 聲響模塊 從單片機(jī) 聲音接收 LCD顯示 主單片機(jī) 語(yǔ)音播報(bào)控制 圖7 系統(tǒng)總框圖 系統(tǒng)主要由三大模塊組成:聲響模塊、聲音接收模塊、信號(hào)處理模塊。聲響模塊產(chǎn)生聲音信號(hào),由聲音接收模塊接收信號(hào)并產(chǎn)生電流脈沖,經(jīng)總線(xiàn)系統(tǒng)傳送到信號(hào)處理模塊進(jìn)行運(yùn)算處理,將測(cè)試數(shù)據(jù)顯示在LCD顯示屏上。 系統(tǒng)總電路圖見(jiàn)附錄二。 3.2 聲響模塊 圖8 聲響模塊電路圖 通過(guò)單片機(jī)產(chǎn)生500Hz的方波信號(hào),利用單管放大后給喇叭發(fā)聲。其中電位器可對(duì)音量進(jìn)行調(diào)節(jié)。 3.3 從單片機(jī)最小系統(tǒng) 圖9 從單片機(jī)最小系統(tǒng) 單片機(jī)最小系統(tǒng)采用的是TI公司生產(chǎn)的超低功耗的MSP430G2452單片機(jī)為核心,其中9號(hào)端口為P2.1,實(shí)際電路中需和聲源模塊相連接。 3.4聲音接收模塊 圖10 接收系統(tǒng)模塊電路 3.5信號(hào)處理模塊 信號(hào)處理模塊由總線(xiàn)控制單元,MSP430G2553為核的Launchpad以及LCD顯示屏共同組成。單片機(jī)內(nèi)部運(yùn)算處理后將結(jié)果送入LCD顯示。 圖11 主單片機(jī)及顯示 3.6 語(yǔ)音模塊 采用ISD4004語(yǔ)音錄放芯片制作成語(yǔ)音播報(bào)模塊。利用lm386語(yǔ)音功放芯片放大。 四. 軟件設(shè)計(jì) 4.1 軟件流程圖 設(shè)計(jì)采用MSP430G2553為核心的Launchpad負(fù)責(zé)信號(hào)的處理并控制LCD顯示屏顯示相應(yīng)數(shù)據(jù)。 主程序流程圖如下: 開(kāi)始 初始化MCU 初始化LCD 接收信號(hào) 進(jìn)入中斷 數(shù)據(jù)處理 退出中斷 LCD顯示數(shù)據(jù) 結(jié)束 中斷流程圖: 進(jìn)入中斷 判斷先后 x y z j 顯示數(shù)據(jù) 讀取坐標(biāo) 退出中斷 中斷程序開(kāi)始后,系統(tǒng)首先對(duì)聲音接收模塊采集到的信息進(jìn)行判斷,找到距離聲源最近的接收器,再按時(shí)間差分別得出其它3個(gè)接收器的距離差,再通過(guò)單片機(jī)就可以計(jì)算出聲源所在位置,發(fā)出屏幕顯示數(shù)據(jù)后退出中斷。 額外加入了語(yǔ)音播報(bào)裝置,在每次采集測(cè)試數(shù)據(jù)開(kāi)始和結(jié)束都會(huì)進(jìn)行一次自動(dòng)語(yǔ)音播報(bào)。 五. 測(cè)試結(jié)果與分析 5.1 測(cè)試方法與儀器 先測(cè)試4個(gè)定點(diǎn)(分別為(10,10)(45,10)(10,25)(45,25))來(lái)標(biāo)定4個(gè)聲音接收模塊的精度等級(jí),然后采取隨機(jī)取點(diǎn)方式得到測(cè)試數(shù)據(jù)。 測(cè)試中主要用到的儀器有直流穩(wěn)壓電源,示波器等。 5.2 測(cè)試數(shù)據(jù) 選中 坐標(biāo) 接收時(shí)間差 測(cè)試 坐標(biāo) 誤差 (cm) x y z j (35,15) 361 13 83 471 (39,15) 4 (25,10) 13 108 303 237 (23,12) 3 (40,20) 564 13 52 10 (39,20) 1 (15,15) 13 77 52 95 (21,17) 5 (25,15) 13 108 321 237 (23,12) 3 測(cè)試數(shù)據(jù) 5.3 測(cè)試結(jié)果分析 測(cè)試平均誤差在5cm以?xún)?nèi),部分坐標(biāo)點(diǎn)能達(dá)到3cm標(biāo)準(zhǔn),符合設(shè)計(jì)要求。 5.4 測(cè)試結(jié)果 本設(shè)計(jì)制作完成了題目要求的基本部分的全部要求和發(fā)揮部分的大部分要求,達(dá)到設(shè)計(jì)要求。個(gè)別指標(biāo)由于時(shí)間有限只完成相應(yīng)的軟件和硬件設(shè)計(jì),整體調(diào)試還未能全部完成。 參考文獻(xiàn) [1] 范紅剛,魏學(xué)海,陳和.51單片機(jī)自學(xué)筆記;北京,北京航空航天大學(xué)出版社2010年1月第1版 [2] 王宜懷,曹金華.嵌入式系統(tǒng)設(shè)計(jì)實(shí)戰(zhàn);北京,北京航空航天大學(xué)出版社2011年5月第1版 [3] 聞怡洋.無(wú)線(xiàn)設(shè)備編程指南;北京,北京大學(xué)出版社2004年7月第1版 [4] 李玉柏.最小系統(tǒng)設(shè)計(jì)與應(yīng)用;四川,電子科技大學(xué)出版社2012年4月第1版 [5] 鐘洪聲.電子電路設(shè)計(jì)技術(shù)基礎(chǔ);四川,電子科技大學(xué)出版社2012年4月第1版 [6] 王昊,李昕.集成運(yùn)放應(yīng)用電路設(shè)計(jì)360例;北京,電子工業(yè)出版社2007年1月 [7] 喻金錢(qián),喻斌.短距離無(wú)線(xiàn)通信詳解—基于單片機(jī)控制;北京,北京航空航天大學(xué)出版社2009年4月 附錄一: 元器件清單 元器件名 數(shù)量 MSP430G2553 1片 MSP430G2452 1片 LP2950-33LPRE3 1片 LM2577S 1片 LM393 4片 MIC 4個(gè) BUZZER 1個(gè) 穩(wěn)壓管7805 1個(gè) LCD12864 1個(gè) 電位器 若干 電阻 若干 電容 若干 電池 2節(jié) 電感 2個(gè) 附錄二: 系統(tǒng)總電路圖 附錄三: 程序 #include "msp430g2553.h" #include "math.h" #define CS12864_SET P2OUT |=BIT0 #define CS12864_CLR P2OUT &=~BIT0 #define SID12864_SET P2OUT |=BIT1 #define SID12864_CLR P2OUT &=~BIT1 #define SCLK12864_SET P2OUT |=BIT2 #define SCLK12864_CLR P2OUT &=~BIT2 signed int s_1=0; signed int s_2=0; unsigned char ss; unsigned char tank=0; unsigned char state=0; //4004 unsigned int time=0; unsigned char i; unsigned int temp; #define ISD_SS_SET (P2OUT |=BIT4) #define ISD_SS_CLR (P2OUT &=~BIT4) #define ISD_SCK_SET (P2OUT |=BIT3) #define ISD_SCK_CLR (P2OUT &=~BIT3) #define ISD_MOSI_SET (P2OUT |=BIT5) #define ISD_MOSI_CLR (P2OUT &=~BIT5) //************************************ //ISD4002 spi串行發(fā)送子程序,8位數(shù)據(jù) //************************************ void spi_send(unsigned char isdx) { unsigned char isx_counter; ISD_SS_CLR; //ss=0,打開(kāi)spi通信端 ISD_SCK_CLR; for(isx_counter=0;isx_counter<8;isx_counter++) //先發(fā)低位再發(fā)高位,依次發(fā)送。 { if ((isdx&0x01)==1) ISD_MOSI_SET; else ISD_MOSI_CLR; isdx=isdx>>1; ISD_SCK_SET; __delay_cycles(6); ISD_SCK_CLR; __delay_cycles(6); } } //********發(fā)送掉電指令,并延遲50ms void isd_pd(void)//4004 { __delay_cycles(10000); spi_send(0x20); ISD_SS_SET; __delay_cycles(60000); spi_send(0x20); ISD_SS_SET; __delay_cycles(120000); } void isd_stop()//4004 { __delay_cycles(1000); /*spi_send(0); //發(fā)送放音起始地址低位 __delay_cycles(3); spi_send(0); //發(fā)送放音起始地址高位 __delay_cycles(3);*/ spi_send(0x10); //發(fā)送setplay指令字節(jié) ISD_SS_SET; } void isd_setplay(unsigned char adl,unsigned char adh)//4004 { __delay_cycles(10000); spi_send(0x20); ISD_SS_SET; __delay_cycles(25000); __delay_cycles(1000); spi_send(adl); //發(fā)送放音起始地址低位 //__delay_cycles(3); spi_send(adh); //發(fā)送放音起始地址高位 // __delay_cycles(3); spi_send(0xE0); //發(fā)送setplay指令字節(jié) ISD_SS_SET; __delay_cycles(20); spi_send(0xF0); //發(fā)送setplay指令字節(jié) ISD_SS_SET; } void isd_rec(unsigned char adl,unsigned char adh)//4004//4004 { __delay_cycles(10000); spi_send(0x20); ISD_SS_SET; __delay_cycles(25000); isd_stop(); spi_send(0x20); ISD_SS_SET; __delay_cycles(50000); __delay_cycles(1000); spi_send(adl); //發(fā)送放音起始地址低位 spi_send(adh); //發(fā)送放音起始地址高位 spi_send(0xa0); //發(fā)送setplay指令字節(jié) ISD_SS_SET; __delay_cycles(20); spi_send(0xb0); //發(fā)送setplay指令字節(jié) ISD_SS_SET; } const unsigned char s1[51][36]={ 108,108,107,106,105,105,104,103,103,102,101,101,100,99,99,98,97,97,96,95,95,94,94,93,93,92,92,91,91,90,90,89,89,89,88,88,106,106,105,105,104,103,103,102,101,101,100,99,99,98,97,97,96,96,95,94,94,93,93,92,92,91,91,90,90,89,89,88,88,88,87,87,105,104,104,103,102,102,101,100,100,99,99,98,97,97,96,95,95,94,94,93,93,92,92,91,91,90,90,89,89,88,88,87,87,87,86,86,103,102,102,101,101,100,100,99,98,98,97,97,96,95,95,94,94,93,93,92,91,91,90,90,89,89,89,88,88,87,87,86,86,86,85,85,101,101,100,100,99,99,98,97,97,96,96,95,95,94,93,93,92,92,91,91,90,90,89,89,88,88,87,87,87,86,86,85,85,85,84,84,99,99,98,98,97,97,96,96,95,95,94,94,93,93,92,91,91,90,90,89,89,88,88,88,87,87,86,86,85,85,85,84,84,84,83,83,97,97,96,96,96,95,95,94,94,93,93,92,92,91,91,90,90,89,89,88,88,87,87,86,86,86,85,85,84,84,84,83,83,82,82,82,95,95,95,94,94,93,93,93,92,92,91,91,90,90,89,89,88,88,87,87,86,86,86,85,85,84,84,84,83,83,82,82,82,81,81,81,93,93,93,92,92,92,91,91,90,90,89,89,89,88,88,87,87,86,86,85,85,85,84,84,83,83,83,82,82,82,81,81,81,80,80,80,91,91,91,91,90,90,89,89,89,88,88,87,87,87,86,86,85,85,85,84,84,83,83,83,82,82,81,81,81,80,80,80,79,79,79,79,89,89,89,89,88,88,88,87,87,87,86,86,85,85,85,84,84,83,83,83,82,82,82,81,81,81,80,80,80,79,79,79,78,78,78,77,88,87,87,87,87,86,86,86,85,85,85,84,84,83,83,83,82,82,82,81,81,81,80,80,80,79,79,79,78,78,78,77,77,77,77,76,86,85,85,85,85,84,84,84,84,83,83,83,82,82,82,81,81,80,80,80,80,79,79,79,78,78,78,77,77,77,77,76,76,76,76,75,84,83,83,83,83,83,82,82,82,81,81,81,81,80,80,80,79,79,79,78,78,78,77,77,77,77,76,76,76,76,75,75,75,75,74,74,82,82,81,81,81,81,80,80,80,80,79,79,79,79,78,78,78,77,77,77,77,76,76,76,76,75,75,75,75,74,74,74,74,73,73,73,80,80,79,79,79,79,79,78,78,78,78,77,77,77,77,76,76,76,76,75,75,75,75,74,74,74,74,73,73,73,73,73,72,72,72,72,78,78,77,77,77,77,77,77,76,76,76,76,76,75,75,75,75,74,74,74,74,73,73,73,73,73,72,72,72,72,72,71,71,71,71,71,76,76,76,75,75,75,75,75,75,74,74,74,74,74,73,73,73,73,73,72,72,72,72,72,71,71,71,71,71,70,70,70,70,70,70,70,74,74,74,74,73,73,73,73,73,73,72,72,72,72,72,72,71,71,71,71,71,71,70,70,70,70,70,70,69,69,69,69,69,69,68,68,72,72,72,72,71,71,71,71,71,71,71,71,70,70,70,70,70,70,69,69,69,69,69,69,69,68,68,68,68,68,68,68,68,67,67,67,70,70,70,70,70,69,69,69,69,69,69,69,69,69,68,68,68,68,68,68,68,68,67,67,67,67,67,67,67,67,66,66,66,66,66,66,68,68,68,68,68,68,68,67,67,67,67,67,67,67,67,67,67,66,66,66,66,66,66,66,66,66,66,65,65,65,65,65,65,65,65,65,66,66,66,66,66,66,66,66,66,65,65,65,65,65,65,65,65,65,65,65,65,65,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,61,61,61,61,61,61,61,61,61,61,61,61,61,61,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,60,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,59,59,59,59,59,59,59,59,59,59,59,59,59,59,56,56,56,56,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,58,58,58,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,56,56,56,56,56,56,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,50,50,50,50,50,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,54,54,54,54,54,54,48,48,48,48,49,49,49,49,49,49,49,49,50,50,50,50,50,50,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,53,53,53,46,46,46,46,47,47,47,47,47,47,48,48,48,48,48,48,49,49,49,49,49,49,50,50,50,50,50,50,51,51,51,51,51,51,52,52,44,44,44,45,45,45,45,45,45,46,46,46,46,46,47,47,47,47,47,48,48,48,48,48,49,49,49,49,49,50,50,50,50,50,50,50,42,42,43,43,43,43,43,43,44,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,47,48,48,48,48,48,49,49,49,49,49,40,40,41,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,47,48,48,48,48,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,36,37,37,37,37,37,38,38,38,39,39,39,39,40,40,40,41,41,41,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,34,35,35,35,35,36,36,36,36,37,37,37,38,38,38,39,39,40,40,40,40,41,41,41,42,42,42,43,43,43,43,44,44,44,44,45,32,33,33,33,33,34,34,34,35,35,35,36,36,37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42,43,43,43,43,44,31,31,31,31,32,32,32,33,33,33,34,34,35,35,35,36,36,37,37,37,38,38,38,39,39,39,40,40,40,41,41,41,42,42,42,43,29,29,29,29,30,30,31,31,31,32,32,33,33,33,34,34,35,35,35,36,36,37,37,37,38,38,39,39,39,40,40,40,41,41,41,41,27,27,27,28,28,28,29,29,30,30,31,31,31,32,32,33,33,34,34,35,35,35,36,36,37,37,37,38,38,38,39,39,39,40,40,40,25,25,25,26,26,27,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,34,35,35,36,36,36,37,37,38,38,38,39,39,39,23,23,24,24,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,34,34,34,35,35,36,36,36,37,37,38,38,38,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,29,29,30,30,31,31,32,32,32,33,33,34,34,35,35,35,36,36,36,37,37,19,19,20,20,21,21,22,23,23,24,24,25,25,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,33,34,34,35,35,35,36,36,17,18,18,19,19,20,20,21,22,22,23,23,24,25,25,26,26,27,27,28,29,29,30,30,31,31,31,32,32,33,33,34,34,34,35,35,15,16,16,17,18,18,19,20,20,21,21,22,23,23,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,33,33,33,34,34,14,14,15,15,16,17,17,18,19,19,20,21,21,22,23,23,24,24,25,26,26,27,27,28,28,29,29,30,30,31,31,32,32,32,33,33,12,12,13,14,15,15,16,17,17,18,19,19,20,21,21,22,23,23,24,25,25,26,26,27,27,28,28,29,29,30,30,31,31,31,32,32, }; const unsigned char s2[51][36]={ 93,92,90,88,86,84,82,80,78,77,75,73,71,69,67,65,63,61,59,57,55,53,51,49,47,45,43,42,40,38,36,34,32,30,28,27,93,91,89,87,86,84,82,80,78,76,74,73,71,69,67,65,63,61,59,57,55,53,51,49,47,46,44,42,40,38,36,34,33,31,29,27,92,90,89,87,85,83,82,80,78,76,74,72,70,69,67,65,63,61,59,57,55,53,51,50,48,46,44,42,40,38,37,35,33,31,30,28,91,90,88,87,85,83,81,80,78,76,74,72,70,68,67,65,63,61,59,57,55,53,52,50,48,46,44,42,40,39,37,35,33,32,30,29,91,89,88,86,84,83,81,79,77,76,74,72,70,68,66,65,63,61,59,57,55,54,52,50,48,46,44,43,41,39,37,36,34,32,31,29,90,89,87,86,84,82,81,79,77,75,74,72,70,68,66,65,63,61,59,57,55,54,52,50,48,46,45,43,41,39,38,36,34,33,31,30,89,88,87,85,83,82,80,79,77,75,73,72,70,68,66,64,63,61,59,57,56,54,52,50,48,47,45,43,41,40,38,37,35,33,32,31,89,87,86,84,83,81,80,78,76,75,73,71,70,68,66,64,63,61,59,57,56,54,52,50,49,47,45,44,42,40,39,37,36,34,33,31,88,87,85,84,82,81,79,78,76,75,73,71,69,68,66,64,63,61,59,57,56,54,52,51,49,47,45,44,42,41,39,38,36,35,33,32,88,86,85,83,82,80,79,77,76,74,73,71,69,68,66,64,63,61,59,57,56,54,52,51,49,47,46,44,43,41,40,38,37,35,34,32,87,86,84,83,82,80,79,77,75,74,72,71,69,67,66,64,62,61,59,58,56,54,53,51,49,48,46,45,43,41,40,38,37,36,34,33,86,85,84,82,81,80,78,77,75,74,72,70,69,67,66,64,62,61,59,58,56,54,53,51,50,48,46,45,43,42,40,39,38,36,35,34,86,85,83,82,81,79,78,76,75,73,72,70,69,67,66,64,62,61,59,58,56,54,53,51,50,48,47,45,44,42,41,39,38,37,35,34,85,84,83,81,80,79,77,76,75,73,72,70,69,67,65,64,62,61,59,58,56,55,53,51,50,48,47,45,44,43,41,40,39,37,36,35,85,83,82,81,80,78,77,76,74,73,71,70,68,67,65,64,62,61,59,58,56,55,53,52,50,49,47,46,44,43,42,40,39,38,37,35,84,83,82,81,79,78,77,75,74,72,71,70,68,67,65,64,62,61,59,58,56,55,53,52,50,49,48,46,45,43,42,41,39,38,37,36,84,82,81,80,79,78,76,75,74,72,71,69,68,67,65,64,62,61,59,58,56,55,53,52,51,49,48,46,45,44,42,41,40,39,38,36,83,82,81,80,78,77,76,75,73,72,71,69,68,66,65,64,62,61,59,58,56,55,54,52,51,49,48,47,45,44,43,42,40,39,38,37,83,82,80,79,78,77,76,74,73,72,70,69,68,66,65,63,62,61,59,58,57,55,54,52,51,50,48,47,46,44,43,42,41,40,38,37,82,81,80,79,78,76,75,74,73,71,70,69,67,66,65,63,62,61,59,58,57,55,54,53,51,50,49,47,46,45,44,42,41,40,39,38,82,81,80,78,77,76,75,74,72,71,70,69,67,66,65,63,62,61,59,58,57,55,54,53,51,50,49,48,46,45,44,43,42,40,39,38,81,80,79,78,77,76,75,73,72,71,70,68,67,66,65,63,62,61,59,58,57,55,54,53,52,50,49,48,47,45,44,43,42,41,40,39,81,80,79,78,77,75,74,73,72,71,69,68,67,66,64,63,62,61,59,58,57,56,54,53,52,51,49,48,47,46,45,43,42,41,40,39, 80,79,78,77,76,75,74,73,72,70,69,68,67,66,64,63,62,61,59,58,57,56,54,53,52,51,50,48,47,46,45,44,43,42,41,40,80,79,78,77,76,75,74,73,71,70,69,68,67,65,64,63,62,61,59,58,57,56,55,53,52,51,50,49,47,46,45,44,43,42,41,40,80,79,78,77,76,74,73,72,71,70,69,68,67,65,64,63,62,61,59,58,57,56,55,53,52,51,50,49,48,47,46,44,43,42,41,40,79,78,77,76,75,74,73,72,71,70,69,68,66,65,64,63,62,61,59,58,57,56,55,54,52,51,50,49,48,47,46,45,44,43,42,41,79,78,77,76,75,74,73,72,71,70,69,67,66,65,64,63,62,61,59,58,57,56,55,54,53,51,50,49,48,47,46,45,44,43,42,41,78,78,77,76,75,74,73,72,70,69,68,67,66,65,64,63,62,61,59,58,57,56,55,54,53,52,51,50,48,47,46,45,44,43,42,42,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,77,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,43,77,76,75,74,74,73,72,71,70,69,68,67,66,65,64,63,62,61,59,58,57,56,55,54,53,52,51,50,49,48,47,46,46,45,44,43,77,76,75,74,73,72,71,70,70,69,68,67,66,65,64,63,62,61,59,58,57,56,55,54,53,52,51,50,50,49,48,47,46,45,44,43,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,76,75,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,45,44,76,75,74,73,73,72,71,70,69,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,51,50,49,48,47,47,46,45,44,76,75,74,73,72,71,71,70,69,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,51,50,49,49,48,47,46,45,44,75,75,74,73,72,71,70,70,69,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,51,50,50,49,48,47,46,45,45,75,74,74,73,72,71,70,69,69,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,51,51,50,49,48,47,46,46,45,75,74,73,73,72,71,70,69,68,68,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,52,52,51,50,49,48,47,47,46,45,75,74,73,72,72,71,70,69,68,67,67,66,65,64,63,62,61,60,60,59,58,57,56,55,54,53,53,52,51,50,49,48,48,47,46,45,74,74,73,72,71,7- 1.請(qǐng)仔細(xì)閱讀文檔,確保文檔完整性,對(duì)于不預(yù)覽、不比對(duì)內(nèi)容而直接下載帶來(lái)的問(wèn)題本站不予受理。
- 2.下載的文檔,不會(huì)出現(xiàn)我們的網(wǎng)址水印。
- 3、該文檔所得收入(下載+內(nèi)容+預(yù)覽)歸上傳者、原創(chuàng)作者;如果您是本文檔原作者,請(qǐng)點(diǎn)此認(rèn)領(lǐng)!既往收益都?xì)w您。
下載文檔到電腦,查找使用更方便
9.9 積分
下載 |
- 配套講稿:
如PPT文件的首頁(yè)顯示word圖標(biāo),表示該P(yáng)PT已包含配套word講稿。雙擊word圖標(biāo)可打開(kāi)word文檔。
- 特殊限制:
部分文檔作品中含有的國(guó)旗、國(guó)徽等圖片,僅作為作品整體效果示例展示,禁止商用。設(shè)計(jì)者僅對(duì)作品中獨(dú)創(chuàng)性部分享有著作權(quán)。
- 關(guān) 鍵 詞:
- 2012 TI 電子設(shè)計(jì) 競(jìng)賽 聲音 定位 系統(tǒng) 設(shè)計(jì) 報(bào)告
鏈接地址:http://www.szxfmmzy.com/p-8257922.html