版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、 DSP實(shí)驗(yàn)報(bào)告 院系名稱 電氣與信息工程學(xué)院 專業(yè)名稱 電氣工程及其自動(dòng)化 班 級(jí) 電氣1002班 學(xué)生姓名 蘇 美 龍 學(xué) 號(hào)指導(dǎo)老師 易 吉 良 2013年 11 月 6 日 實(shí)驗(yàn)一 撥碼開關(guān)實(shí)驗(yàn)、實(shí)驗(yàn)?zāi)康?.了解DSP開發(fā)系統(tǒng)的組成和結(jié)構(gòu)2.了解IO 的基本編程方法二、實(shí)驗(yàn)設(shè)備計(jì)算機(jī),CCS3.1版本軟件,DSP 仿真器,E300 實(shí)驗(yàn)箱,2812CPU板(新的)三、實(shí)驗(yàn)原理8位的數(shù)字量輸入(由撥碼開關(guān)產(chǎn)生),當(dāng)撥碼打到靠近LED時(shí)為低。相反為高。通過74LS244(可讀)緩沖連接到DSP 的數(shù)據(jù)總線的低8 位。CPU 通過讀指令讀取到撥碼開關(guān)產(chǎn)生的8 位輸出的數(shù)字量,然后CPU通過寫
2、指令把讀出的8 位數(shù)字量寫入(0x0200)單元內(nèi),使連接到DSP的數(shù)據(jù)總線的低8 位的74LS273的輸出端產(chǎn)生高低信號(hào),此時(shí)LED 燈產(chǎn)生亮滅。當(dāng)對(duì)應(yīng)LED 燈點(diǎn)亮?xí)r說明輸出為低,熄滅時(shí)為高。(器件 74LS244和74LS273詳細(xì)的介紹請(qǐng)參看數(shù)據(jù)手冊(cè))。數(shù)字量輸入輸出單元的資源分配如下:基地址:0000h(當(dāng)CS0為0時(shí)分配有效)數(shù)字量分配空間為數(shù)據(jù)空間地址:基地址+0x200(低8位,只讀)撥碼開關(guān)擴(kuò)展工作原理說明:74LS244 片選號(hào)、74LS273 片選信號(hào)和74LS273 復(fù)位信號(hào)由E300 上CPLD 譯碼產(chǎn)生。本實(shí)驗(yàn)使用DSP 數(shù)據(jù)總線的低8位。本實(shí)驗(yàn)的程序流程框圖如下:
3、四、實(shí)驗(yàn)步驟1. 2812CPU板上的JUMP1的1和2腳短接,撥碼開關(guān)SW1的第二位置ON。2.E300 板上的開關(guān)SW4 的第一位置ON,其余OFF;SW5開關(guān)全部置ON;其余開關(guān)全部置OFF。3. 運(yùn)行Code Composer Studio (CCS)(ccs3.1需要“DEBUGConnect” )4. 用“ProjectOpen”打開系統(tǒng)項(xiàng)目文件e300.test normalDSP2801x_examplee300_02_swich Exampla_281_swich.pjt;5. 編譯全部文件并裝載normalDSP2801x_examplee300_02_swich Exam
4、pla_281_swich.out;6. 單擊“Debug Go Main”跳到主程序的開始;7. 單擊“Debug RUN”運(yùn)行程序8.任意撥動(dòng)E300 底板上的撥動(dòng)開關(guān),觀察LED和撥動(dòng)開關(guān)的對(duì)應(yīng)情況。(LED1-LED7分別對(duì)應(yīng)DSP 數(shù)據(jù)總線的D0-D7);9.單擊“Debug Halt” 暫停持續(xù)運(yùn)行,開關(guān)將對(duì)燈失去控制.10.關(guān)閉所有窗口,本實(shí)驗(yàn)完。五、實(shí)驗(yàn)結(jié)果設(shè)置好CCS的環(huán)境,打開本工程,編譯、下載、運(yùn)行。調(diào)整數(shù)字輸入輸出單元的開關(guān)K1K8,觀察LED1LED8燈亮滅的變化為:撥動(dòng)LED1LED8燈相應(yīng)的開關(guān)K1K8,則對(duì)應(yīng)的燈亮滅。修改后的實(shí)驗(yàn)原程序:#include &qu
5、ot;DSP281x_Device.h" / DSP281x Headerfile Include File#include "DSP281x_Examples.h" / DSP281x Examples Include Filevoid main(void) unsigned int temp; temp = 0; InitSysCtrl();/初始化PLL,WatchDog,使能外圍時(shí)鐘,該初始化文件在"DSP281x_SysCtrl.c"中DINT;/關(guān)閉CPU中斷InitPieCtrl();IER = 0x0000;/關(guān)閉中斷和清除所有
6、中斷標(biāo)志 IFR = 0x0000;InitPieVectTable(); for(;) asm(" nop ");temp = *(int *)0x2200&0x0007; /讀入0x2200地址的開關(guān)量值并賦給tempswitch(temp) case 0x0000:* (int *)0x2200 = 0x00fe; break; case 0x0001:* (int *)0x2200 = 0x00fd; break; case 0x0002:* (int *)0x2200 = 0x00fb; break; case 0x0003:* (int *)0x2200
7、 = 0x00f7; break; case 0x0004:* (int *)0x2200 = 0x00ef; break;case 0x0005:* (int *)0x2200 = 0x00df; break;case 0x0006:* (int *)0x2200 = 0x00bf; break;case 0x0007:* (int *)0x2200 = 0x007f; break;default:break; asm(" nop ");asm(" nop "); 實(shí)驗(yàn)二 定時(shí)器實(shí)驗(yàn)一、實(shí)驗(yàn)?zāi)康?、熟悉F2812的CPU定時(shí)器;2、掌握F2812的CP
8、U定時(shí)器的控制方法;3、學(xué)會(huì)使用CUP定時(shí)器中斷方式控制程序流程。二、實(shí)驗(yàn)設(shè)備計(jì)算機(jī),CCS3.1版軟件,DSP硬件仿真器,E300實(shí)驗(yàn)箱,2812CPU板。3、 實(shí)驗(yàn)原理說明樣例實(shí)驗(yàn)是采用CPU定時(shí)器來定時(shí)LED亮滅的。F2812的CPU定時(shí)器不同于事件管理器(EVAEVB)中的通用定時(shí)器(GP)。F2812的CPU共有三個(gè)定時(shí)器,其中,CPU1定時(shí)器1和2被保留用作實(shí)驗(yàn)操作系統(tǒng)OS例如DSPBIOS),CPU定時(shí)器0可以供用戶使用。定時(shí)器的一般操作如下:將周期寄存器PRDH:PRD中的值裝入32位計(jì)數(shù)器寄存器TIMI:TIM。然后計(jì)數(shù)器寄存器以F2812x的SYSCLKLT速率遞減。當(dāng)計(jì)數(shù)
9、器減到0,就會(huì)產(chǎn)生一個(gè)定時(shí)器中斷輸出定時(shí)信號(hào)(一個(gè)中斷脈沖)。下圖為CPU定時(shí)器的內(nèi)部結(jié)構(gòu):樣例實(shí)驗(yàn)的程序如下:4、 實(shí)驗(yàn)步驟和內(nèi)容 1、F2812CPU板的JUPMI的1和2腳短接,撥碼開關(guān)SW1的第二位置ON;其余OFF。 2、E300 底板的開關(guān)SW4 的第1位置ON,其余位置OFF。其余開關(guān)設(shè)置為OFF; 3、運(yùn)行CCS軟件,調(diào)入樣例程序,裝載并運(yùn)行;(進(jìn)入CCS界面后需要點(diǎn)“Debug-Connect”); 4、加載“.e300_03cpu_timerDebugEample_281x_cpu_timer.out”;單擊“Debug Animate”運(yùn)行,可觀察到LED1LED8的變化
10、規(guī)律: 先LED1,8點(diǎn)亮LED2,7D點(diǎn)亮LED1,8熄滅LED3,6點(diǎn)亮LED2,7熄滅LED4,5點(diǎn)亮LED3,6熄滅后LED4,5熄滅LED3,6點(diǎn)亮LED3,6熄滅LED2,7點(diǎn)亮LED2,7熄滅LED1,8點(diǎn)亮。6、單擊“Debug Halt”,暫停程序運(yùn)行,LED燈停止閃爍;單擊“RUN”,LED燈又開始閃爍變化;7、 結(jié)束試驗(yàn)程序8、修改后的實(shí)驗(yàn)原程序:#include "DSP281x_Device.h" #include "DSP281x_Examples.h" interrupt void cpu_timer0_isr(void);
11、void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period);void main(void) unsigned int temp; temp = 0; InitSysCtrl(); DINT; InitPieCtrl(); IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; PieVectTable.TINT0 = &cpu_timer0_isr; EDIS; InitCpuTimers(); ConfigCpuTimer(&Cpu
12、Timer0, 100, 100000); StartCpuTimer0(); IER |= M_INT1; PieCtrlRegs.PIEIER1.bit.INTx7 = 1; EINT; ERTM; for(;) temp = *(int *)0x2200&0x0001;if (temp=0) if(CpuTimer0.InterruptCount<1) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; else if(CpuTimer0.
13、InterruptCount<2) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<3) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else i
14、f(CpuTimer0.InterruptCount<4) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<5) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x
15、00df; else if(CpuTimer0.InterruptCount<6) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; *(int *)0x2200=0x00f7; *(int *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<7) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00f7; *(int
16、 *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<8) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<9) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<10)
17、 asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<11) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<12) asm(" nop "); asm(" nop "); *(int
18、*)0x2200=0x00ff; else CpuTimer0.InterruptCount = 0; else if (temp=1) if(CpuTimer0.InterruptCount<9) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; else if(CpuTimer0.InterruptCount<8) asm(" nop "); asm(" nop "); *(int *)0x2200=0
19、x00fe; *(int *)0x2200=0x007f; *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<3) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<4) asm(" nop "); asm(" nop "); *(in
20、t *)0x2200=0x00fd; *(int *)0x2200=0x00bf; *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<5) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<6) asm(" nop "); asm(" nop &
21、quot;); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; *(int *)0x2200=0x00f7; *(int *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<7) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00f7; *(int *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<8) asm(" nop "); asm(
22、" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<9) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<10) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTi
23、mer0.InterruptCount<11) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<12) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else CpuTimer0.InterruptCount = 0; interrupt void cpu_timer0_isr(voi
24、d) CpuTimer0.InterruptCount+; PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;實(shí)驗(yàn)三 鍵盤接口實(shí)驗(yàn)(E300)、實(shí)驗(yàn)?zāi)康?. 了解DSP開發(fā)系統(tǒng)的組成和結(jié)構(gòu)2. 了解鍵盤的基本編程方法3. 內(nèi)存觀察工具的使用二、實(shí)驗(yàn)設(shè)備計(jì)算機(jī),CCS3.1版本軟件,DSP 仿真器,E300 實(shí)驗(yàn)箱,2812CPU板三、實(shí)驗(yàn)原理本實(shí)驗(yàn)程序由二部分組成:1.由外部中斷2產(chǎn)生中斷信號(hào)2.鍵值讀取程序:該部分有兩種方法進(jìn)行鍵值的判斷。方法1:利用內(nèi)存觀察工具進(jìn)行觀察方法2:利用LED1-LED8 的亮滅對(duì)應(yīng)顯示鍵值。a) 外部中斷2的應(yīng)用參照實(shí)驗(yàn)二;b) 內(nèi)
25、存觀察鍵值:程序中定義了三個(gè)變量“W”“row”和“col”。“W”代表是CPLD 中鍵盤的掃描數(shù)值,“row”和“col”分別代表鍵盤的行和列,由行和列可以判定按鍵的位置。上述三個(gè)變量可以在觀察窗口中觀察的。c) 利用LED 燈顯示鍵值原理,參看實(shí)驗(yàn)一。具體的LED 燈顯示值以查表的形式讀出,請(qǐng)參看“e300_codec.h”庫文件。本實(shí)驗(yàn)的CPLD地址譯碼說明: 基地址:0x2000,當(dāng)?shù)装迤xCS1為低時(shí),分配有效。 CPU的數(shù)據(jù)空間:基地址+0x0200 LED燈 output8外部中斷用XINT2:由CPLD分配,中斷信號(hào)由鍵盤產(chǎn)生。 中斷下降沿觸發(fā)。KEY_DAY_REG(R):基
26、地址+0x0004;四、實(shí)驗(yàn)步驟和內(nèi)容 1. 2812CPU板JUMP1的1和2腳短接,撥碼開關(guān)SW1的第二位ON; 2.E300 板上的開關(guān)SW4 的第一位置ON,其余OFF;SW3 的第四位置ON 其余的SW 置OFF;3.運(yùn)行Code Composer Studio (CCS)(ccs3.1需要“DEBUGConnect” );4.打開系統(tǒng)項(xiàng)目文件e300.test normal DSP281x_examplese300_06_key interface Example_281x_ keyled.pjt;5.編譯全部文件并裝載“Debug keyled.out”文件;6.單擊“Debug
27、Go Main”跳到主程序的開始;7.指定位置設(shè)置斷點(diǎn);8. View-Watch Window 打開變量觀察窗口; 將變量“w”“ row”和“ col”添加到觀察窗口中,改變變量觀察窗口的顯示方式為HEX 顯示; 點(diǎn)擊“Debug-Animate”全速運(yùn)行,然后點(diǎn)擊E300 板上鍵盤按鍵,觀察窗口中變量變化,同時(shí)LED1-LED8 燈也相應(yīng)變化,指示鍵值。(注意程序中KEY_E和KEY_F分別代表鍵盤上的“*”和“#”鍵值。十六進(jìn)制數(shù)代表的意義為:高4 位為按鍵的行值,低4 位為按鍵的列值。注意:“w”中的低八位表; 11.關(guān)閉所有窗口,本實(shí)驗(yàn)完畢。五、實(shí)驗(yàn)程序框圖修改后的實(shí)驗(yàn)原程序:#i
28、nclude "DSP281x_Device.h" / DSP281x Headerfile Include File#include "DSP281x_Examples.h" / DSP281x Examples Include File#include "e300_codec.h"void init_xint2(void);interrupt void xint2_isr(void); /中斷2中斷子程序void read_data ();/讀取數(shù)據(jù)子函數(shù)void conv(void);/鍵盤數(shù)值轉(zhuǎn)換子函數(shù)interrupt vo
29、id cpu_timer0_isr(void);void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period);unsigned int row,col,w;int a=0;unsigned int temp=0;void init_xint2() XIntruptRegs.XINT2CR.all=0x0001; /低電平觸發(fā)中斷 interrupt void xint2_isr() /中斷2中斷子程序 a=1; /開總中斷 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; in
30、terrupt void cpu_timer0_isr(void) CpuTimer0.InterruptCount+;more interrupts from group 1 PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; void main(void)ClocksDSP281x_SysCtrl.c file. InitSysCtrl(); DINT;default state.disabled and flags InitPieCtrl();CPU interrupt flags: IER = 0x0000; IFR = 0x0000;to the shel
31、l Interrupt InitPieVectTable(); EALLOW; / This is needed to write to EALLOW protected registers PieVectTable.XINT2 = &xint2_isr; PieVectTable.TINT0 = &cpu_timer0_isr; EDIS; InitCpuTimers(); / For this example, only initialize the Cpu Timerssecond:uSeconds) ConfigCpuTimer(&CpuTimer0, 100,
32、 100000); StartCpuTimer0(); init_xint2(); PieCtrlRegs.PIEIER1.all = 0x0050; IER |= M_INT1 ; EINT; / Enable Global interrupt INTM ERTM; / Enable Global realtime interrupt DBGM for(;) if(a=1)/加軟件斷點(diǎn) temp = *(int *)0x2200&0x0001;if (temp=0) if(CpuTimer0.InterruptCount<1) asm(" nop "); a
33、sm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; else if(CpuTimer0.InterruptCount<2) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<3) asm(" no
34、p "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<4) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<5) a
35、sm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<6) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; *(int *)0x2200=0x00f7; *(int *)0x2200=0x00ef; else if(CpuTimer0.InterruptC
36、ount<7) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00f7; *(int *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<8) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<9) asm(" nop "); asm(" nop ")
37、; *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<10) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<11) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if
38、(CpuTimer0.InterruptCount<12) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else CpuTimer0.InterruptCount = 0; else if (temp=1) if(CpuTimer0.InterruptCount<9) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; else if(CpuTimer
39、0.InterruptCount<8) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fe; *(int *)0x2200=0x007f; *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<3) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else
40、 if(CpuTimer0.InterruptCount<4) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<5) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=
41、0x00df; else if(CpuTimer0.InterruptCount<6) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; *(int *)0x2200=0x00f7; *(int *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<7) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00f7; *(i
42、nt *)0x2200=0x00ef; else if(CpuTimer0.InterruptCount<8) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<9) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fb; *(int *)0x2200=0x00df; else if(CpuTimer0.InterruptCount<1
43、0) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00ff; else if(CpuTimer0.InterruptCount<11) asm(" nop "); asm(" nop "); *(int *)0x2200=0x00fd; *(int *)0x2200=0x00bf; else if(CpuTimer0.InterruptCount<12) asm(" nop "); asm(" nop "); *(in
44、t *)0x2200=0x00ff; else CpuTimer0.InterruptCount = 0; read_data();/ conv(); else 6、 實(shí)驗(yàn)建議 本實(shí)驗(yàn)程序采用外部中斷的方式來判斷鍵盤是否被按下,除了這種方法外,還可以根據(jù)鍵盤按下標(biāo)志位“KEY_FLAG”,利用查詢方式來編寫程序,“KEY_FLAG”是CPLD內(nèi)部狀態(tài)寄存器中的一個(gè)只讀位.CPLD內(nèi)部狀態(tài)寄存器:CPLD_ST實(shí)驗(yàn)四 A/D轉(zhuǎn)換實(shí)驗(yàn)(E300)一、實(shí)驗(yàn)?zāi)康? 了解DSP 中A/D轉(zhuǎn)換模塊的特點(diǎn);2 了解A/D轉(zhuǎn)換模塊的原理結(jié)構(gòu);3 掌握A/D轉(zhuǎn)換模塊的使用。二、實(shí)驗(yàn)設(shè)備計(jì)算機(jī),DSP仿真器,TH
45、RSC-2型實(shí)驗(yàn)箱各一臺(tái)。三、實(shí)驗(yàn)原理TMS320F2812的ADC模塊是一個(gè)12位分辨率、高達(dá)80ns轉(zhuǎn)換時(shí)間、具有流水線結(jié)構(gòu)的模數(shù)轉(zhuǎn)換器。此轉(zhuǎn)換器的模擬電路包括:前端模擬多路復(fù)用器(MUXs)、采樣/保持電路(S/H)、轉(zhuǎn)換核、電壓調(diào)節(jié)器以及其他模擬支持電路。數(shù)字電路包括:可編程轉(zhuǎn)換序列發(fā)生器、轉(zhuǎn)換結(jié)果寄存器、模擬電路接口、設(shè)備外圍總線接口以及其他片上模塊接口等,可以直接用于電機(jī)或運(yùn)動(dòng)控制場(chǎng)合。四、實(shí)驗(yàn)內(nèi)容與步驟連接好仿真器、計(jì)算機(jī)與實(shí)驗(yàn)箱,系統(tǒng)上電,實(shí)驗(yàn)箱電源指示燈亮,仿真器上紅色指示燈亮,系統(tǒng)連接正常。打開CCS3.1軟件。圖1.6.3 實(shí)驗(yàn)程序流程圖1圖1.6.3為A/D實(shí)驗(yàn)程序流程
46、圖:采集電位器電壓。A/D用16個(gè)通道采集當(dāng)前電壓值,取平均值,將十六進(jìn)制數(shù)轉(zhuǎn)換成十進(jìn)制數(shù),并處理成電壓量輸出給液晶屏顯示,循環(huán)上述操作。2打開實(shí)驗(yàn)程序dsp2812.1.6-ADC目錄下的工程ADC.pjt,點(diǎn) 編譯、下載。按“F5”運(yùn)行,液晶屏顯示當(dāng)前DSP的ADCINA2(對(duì)應(yīng)試驗(yàn)箱A/D轉(zhuǎn)換單元的ADCINA)通道電壓值,調(diào)節(jié)A/D轉(zhuǎn)換單元的電位器,改變輸入電壓,顯示隨之變化,顯示電壓在03.3V之間。3點(diǎn)“Halt”,停止程序運(yùn)行,恢復(fù)程序指令初始值,并保存,關(guān)閉所有窗口,實(shí)驗(yàn)完畢。修改后的實(shí)驗(yàn)原程序:#include "DSP281x_Device.h" / D
47、SP281x Headerfile Include File#include "DSP281x_Examples.h" / DSP281x Examples Include Fileinterrupt void adc_isr(void);Uint16 LoopCount;Uint16 ConversionCount; double input1256; double input2256;Uint16a4,b4;Uint16 sum1=0,sum2=0void main(void) InitSysCtrl(); EALLOW; SysCtrlRegs.PLLCR.all=0
48、x8; SysCtrlRegs.HISPCP.all = 0x3; / HSPCLK = SYSCLKOUT/6 EDIS; DINT; InitPieCtrl(); IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; / This is needed to write to EALLOW protected register PieVectTable.ADCINT = &adc_isr; EDIS; / This is needed to disable write to EALLOW protected registers InitAdc(); / For this example, init the ADC PieCtrlRegs.PIEIER1.bit.INTx6 = 1; IER |= M_INT1; / Enable CPU Interru
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 簡(jiǎn)單公司場(chǎng)地租用合同
- 貨車轉(zhuǎn)讓合同范本
- 消防維保合同書
- 購銷日化用品的合同
- 氨-柴油雙燃料發(fā)動(dòng)機(jī)性能仿真及優(yōu)化研究
- 一種新型義齒修復(fù)材料JSAM的生物相容性評(píng)價(jià)
- 2025年人教版拓展型課程化學(xué)下冊(cè)階段測(cè)試試卷含答案
- 2025年浙教版九年級(jí)歷史下冊(cè)月考試卷含答案
- 2025年湘師大新版七年級(jí)歷史上冊(cè)月考試卷含答案
- 2025年人教新起點(diǎn)必修3物理上冊(cè)月考試卷
- 全過程造價(jià)咨詢服務(wù)的質(zhì)量、進(jìn)度、保密等保證措施
- 人文關(guān)懷在護(hù)理工作中的體現(xiàn)
- 2025年1月八省聯(lián)考高考綜合改革適應(yīng)性測(cè)試-高三生物(陜西、山西、寧夏、青海卷) 含解析
- 環(huán)保行業(yè)深度研究報(bào)告
- 社會(huì)主義核心價(jià)值觀課件
- 《公路養(yǎng)護(hù)安全培訓(xùn)》課件
- 公益捐助活動(dòng)影響力評(píng)估方法
- 第七講推動(dòng)構(gòu)建新時(shí)代的大國關(guān)系格局-2024年形勢(shì)與政策(課件)
- 2025年高考作文備考:議論文寫作的論證手法
- 2024年可行性研究報(bào)告投資估算及財(cái)務(wù)分析全套計(jì)算表格(含附表-帶只更改標(biāo)紅部分-操作簡(jiǎn)單)
- 湖北省石首楚源“源網(wǎng)荷儲(chǔ)”一體化項(xiàng)目可研報(bào)告
評(píng)論
0/150
提交評(píng)論