DSP實(shí)驗(yàn)報(bào)告集合(程序)+心得體會(huì) 2.doc_第1頁(yè)
DSP實(shí)驗(yàn)報(bào)告集合(程序)+心得體會(huì) 2.doc_第2頁(yè)
DSP實(shí)驗(yàn)報(bào)告集合(程序)+心得體會(huì) 2.doc_第3頁(yè)
DSP實(shí)驗(yàn)報(bào)告集合(程序)+心得體會(huì) 2.doc_第4頁(yè)
DSP實(shí)驗(yàn)報(bào)告集合(程序)+心得體會(huì) 2.doc_第5頁(yè)
已閱讀5頁(yè),還剩24頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

三、實(shí)驗(yàn)原理浮點(diǎn)數(shù)的表達(dá)和計(jì)算是進(jìn)行數(shù)字信號(hào)處理的基本知識(shí);產(chǎn)生正弦信號(hào)是數(shù)字信號(hào)處理中經(jīng)常用到的運(yùn)算;C語(yǔ)言是現(xiàn)代數(shù)字信號(hào)處理表達(dá)的基礎(chǔ)語(yǔ)言和通用語(yǔ)言。寫(xiě)實(shí)現(xiàn)程序時(shí)需要注意兩點(diǎn):(1)浮點(diǎn)數(shù)的范圍及存儲(chǔ)格式;(2)DSP的C語(yǔ)言與ANSI C語(yǔ)言的區(qū)別。四、實(shí)驗(yàn)步驟1.打開(kāi)CCS 并熟悉其界面;2.在CCS環(huán)境中打開(kāi)本實(shí)驗(yàn)的工程(Example_base.pjt),編譯并重建 .out 輸出文件,然后通過(guò)仿真器把執(zhí)行代碼下載到DSP芯片中;3 把X0 , Y0 和Z0添加到Watch窗口中作為觀察對(duì)象(選中變量名,單擊鼠標(biāo)右鍵,在彈出菜單中選擇“Add Watch Window”命令);4 選擇view-graph-time/frequency。 設(shè)置對(duì)話框中的參數(shù): 其中“Start Address”設(shè)為“sin_value”,“Acquisition buffer size”和“Display Data size”都設(shè)為“100”,并且把“DSP Data Type”設(shè)為“32-bit floating point”, 設(shè)置好后觀察信號(hào)序列的波形(sin函數(shù),如圖);5 單擊運(yùn)行;6 觀察三個(gè)變量從初始化到運(yùn)算結(jié)束整個(gè)過(guò)程中的變化;觀察正弦波形從初始化到運(yùn)算結(jié)束整個(gè)過(guò)程中的變化;7 修改輸入序列的長(zhǎng)度或初始值,重復(fù)上述過(guò)程。五、實(shí)驗(yàn)心得體會(huì)通過(guò)本次實(shí)驗(yàn),加深了我對(duì)DSP的認(rèn)識(shí),使我對(duì)DSP實(shí)驗(yàn)的操作有了更進(jìn)一步的理解?;菊莆樟薈CS實(shí)驗(yàn)環(huán)境的使用,并能夠使用C語(yǔ)言進(jìn)行簡(jiǎn)單的DSP程序設(shè)計(jì)。從軟件的安裝到使用軟件進(jìn)行程序設(shè)計(jì)與仿真,鍛煉了自己的動(dòng)手能力,也遇到了不少的坎坷,例如芯片的選擇,不能因?yàn)槁闊┒÷栽摬襟E,否則將會(huì)運(yùn)行出錯(cuò)。附錄實(shí)驗(yàn)程序:#include math.h#include stdio.h#define N 100#define pi 3.14159float sin_value100;float X0,Y0,Z0;void main(void) int i; for(i=0;iN;i+) sin_valuei=0; X0=0.5; /* 0.100 0000 0000 0000 */ Y0=0.5; /* 0.100 0000 0000 0000 */ Z0=X0*Y0; /* 00.01 0000 0000 0000 0000 0000 0000 0000 */ for(i=0;iN;i+) sin_valuei=100*(sin(2*pi*i/N);龍 巖 學(xué) 院實(shí) 驗(yàn) 報(bào) 告班 級(jí) 07電本(1)班 學(xué)號(hào) 2007050344姓 名 楊寶輝 同組人 獨(dú)立 實(shí)驗(yàn)日期 2010-5-20 室溫 大氣壓 成 績(jī) 數(shù)碼管控制實(shí)驗(yàn)一、實(shí)驗(yàn)?zāi)康?. 熟悉2812的指令系統(tǒng);2.熟悉74HC573的使用方法。3.熟悉DSP的IO操作使用方法。二、實(shí)驗(yàn)設(shè)備1.一臺(tái)裝有CCS2000軟件的計(jì)算機(jī);2.插上2812主控板的DSP實(shí)驗(yàn)箱;3.DSP硬件仿真器。三、實(shí)驗(yàn)原理此模塊由數(shù)碼管和四個(gè)鎖存器組成 。數(shù)碼管為共陰極型的。數(shù)據(jù)由2812模塊的低八位輸入,鎖存器的控制信號(hào)由2812模塊輸出,但經(jīng)由CPLD模塊譯碼后再控制對(duì)應(yīng)的八個(gè)四、實(shí)驗(yàn)步驟1.把2812模塊小板插到大板上;2. 在CCS2000環(huán)境中打開(kāi)本實(shí)驗(yàn)的工程編譯Example_7segled.prj,生成輸出文件,通過(guò)仿真器把執(zhí)行代碼下載到DSP芯片;3. 運(yùn)行程序;數(shù)碼管會(huì)顯示18的數(shù)字。 4. 參考源代碼自行修改程序改變顯示樣式。 五、實(shí)驗(yàn)心得體會(huì)通過(guò)本次實(shí)驗(yàn)中,基本掌握了2812的指令系統(tǒng)的特點(diǎn),并能夠了解并熟悉74HC573的使用方法,進(jìn)一步加深了對(duì)DSP的認(rèn)識(shí)。同時(shí),通過(guò)實(shí)驗(yàn)操作DSP的IO操作使用方法,對(duì)于DSP的IO操作可以熟悉的運(yùn)用,學(xué)到更多的知識(shí)。程序見(jiàn)附錄:#include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void delay_loop(void);void Gpio_select(void);/ Global variable for this exampleshort codetab17=0x4020,0x6cc0,0x5800,0x4840,0x6440,0xC040,0xC000,0x4cc0,0x4000,0x4040,0x4400,0xE000,0xD080,0xE800,0xD000,0xD400,0xffff;main() short i; / Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl(); / Specific clock setting for this example: EALLOW; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example/ For this example use the following configuration: Gpio_select();/ Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are cleared. / This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000;/ Initialize the PIE vector table with pointers to the shell Interrupt / Service Routines (ISR). / This will populate the entire table, even if the interrupt/ is not used in this example. This is useful for debug purposes./ The shell ISR routines are found in DSP281x_DefaultIsr.c./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_InitPeripherals.c/ InitPeripherals(); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: GpioDataRegs.GPADAT.all=0; Reg01=0x00; GpioDataRegs.GPADAT.all=0; Reg02=0x00; GpioDataRegs.GPADAT.all=0; Reg03=0x00; GpioDataRegs.GPADAT.all=0; Reg04=0x00; while(1) for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg01=0x00; delay_loop(); for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg02=0x00; delay_loop(); for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg03=0x00; delay_loop(); for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg04=0x00; delay_loop(); void delay_loop() short i,j; for (i = 0; i 32767; i+) for (j = 0; j 10; j+);void Gpio_select(void) Uint16 var1; Uint16 var2; Uint16 var3; var1= 0x0000;/ sets GPIO Muxs as I/Os var2= 0xFFFF;/ sets GPIO DIR as outputs var3= 0x0000;/ sets the Input qualifier values EALLOW;GpioMuxRegs.GPAMUX.all=var1; GpioMuxRegs.GPBMUX.all=var1; GpioMuxRegs.GPDMUX.all=var1; GpioMuxRegs.GPFMUX.all=var1; GpioMuxRegs.GPEMUX.all=var1; GpioMuxRegs.GPGMUX.all=var1; GpioMuxRegs.GPADIR.all=var2;/ GPIO PORTs as output GpioMuxRegs.GPBDIR.all=var2; / GPIO DIR select GPIOs as output GpioMuxRegs.GPDDIR.all=var2; GpioMuxRegs.GPEDIR.all=var2; GpioMuxRegs.GPFDIR.all=var2; GpioMuxRegs.GPGDIR.all=var2; GpioMuxRegs.GPAQUAL.all=var3; / Set GPIO input qualifier values GpioMuxRegs.GPBQUAL.all=var3; GpioMuxRegs.GPDQUAL.all=var3; GpioMuxRegs.GPEQUAL.all=var3; EDIS; / No more. 交通燈控制實(shí)驗(yàn)一、實(shí)驗(yàn)?zāi)康?.熟悉2812的指令系統(tǒng);2.熟悉74HC573的使用方法。3.熟悉DSP的IO操作使用方法。二、實(shí)驗(yàn)設(shè)備1.一臺(tái)裝有CCS2000軟件的計(jì)算機(jī);2.插上2812主控板的DSP實(shí)驗(yàn)箱;3.DSP硬件仿真器。三、實(shí)驗(yàn)原理此模塊由發(fā)光二極管和一個(gè)鎖存器組成。數(shù)據(jù)由2812模塊的低八位輸入,鎖存器的控制信號(hào)由2812模塊輸出,但經(jīng)由CPLD模塊譯碼后再控制鎖存器。四、實(shí)驗(yàn)步驟1. 把2812模塊小板插到大板上;2. 在CCS2000環(huán)境中打開(kāi)本實(shí)驗(yàn)的工程編譯Example_crossled.prj,生成輸出文件,通過(guò)仿真器把執(zhí)行代碼下載到DSP芯片;3. 運(yùn)行程序,發(fā)光二極管按交通燈方式點(diǎn)亮熄滅。 4. 參考源代碼,自行修改程序,實(shí)現(xiàn)不同的交通燈控制方式。 五、實(shí)驗(yàn)心得體會(huì)通過(guò)次實(shí)驗(yàn)中,使我掌握了 2812的指令系統(tǒng)和74HC573的使用方法。同時(shí),使我掌握了DSP的IO操作使用方法。實(shí)驗(yàn)程序見(jiàn)附錄:附錄: #include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void delay_loop(void);void Gpio_select(void);/ Global variable for this examplemain() / Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl(); / Specific clock setting for this example: EALLOW; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example / For this example use the following configuration: Gpio_select(); / Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are cleared. / This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000;/ Initialize the PIE vector table with pointers to the shell Interrupt / Service Routines (ISR). / This will populate the entire table, even if the interrupt/ is not used in this example. This is useful for debug purposes./ The shell ISR routines are found in DSP281x_DefaultIsr.c./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_InitPeripherals.c/ InitPeripherals(); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: while(1) GpioDataRegs.GPADAT.all =0xdc80; Reg00=0x00; delay_loop(); GpioDataRegs.GPADAT.all =0xec40; Reg00=0x00; delay_loop(); GpioDataRegs.GPADAT.all =0xf0c0; Reg00=0x00; delay_loop(); GpioDataRegs.GPADAT.all =0xec40; Reg00=0x00; delay_loop(); void delay_loop() short i,j; for (i = 0; i 32767; i+) for (j = 0; j 50; j+);void Gpio_select(void) Uint16 var1; Uint16 var2; Uint16 var3; var1= 0x0000;/ sets GPIO Muxs as I/Os var2= 0xFFFF;/ sets GPIO DIR as outputs var3= 0x0000;/ sets the Input qualifier values EALLOW; GpioMuxRegs.GPAMUX.all=var1; GpioMuxRegs.GPBMUX.all=var1; GpioMuxRegs.GPDMUX.all=var1; GpioMuxRegs.GPFMUX.all=var1; GpioMuxRegs.GPEMUX.all=var1; GpioMuxRegs.GPGMUX.all=var1; GpioMuxRegs.GPADIR.all=var2;/ GPIO PORTs as output GpioMuxRegs.GPBDIR.all=var2; / GPIO DIR select GPIOs as output GpioMuxRegs.GPDDIR.all=var2; GpioMuxRegs.GPEDIR.all=var2; GpioMuxRegs.GPFDIR.all=var2; GpioMuxRegs.GPGDIR.all=var2; GpioMuxRegs.GPAQUAL.all=var3; / Set GPIO input qualifier values GpioMuxRegs.GPBQUAL.all=var3; GpioMuxRegs.GPDQUAL.all=var3; GpioMuxRegs.GPEQUAL.all=var3; EDIS; /=/ No more./=步進(jìn)電機(jī)控制實(shí)驗(yàn)一、實(shí)驗(yàn)?zāi)康?. 掌握2812通用IO口的使用方法;2. 掌握2812對(duì)步進(jìn)電機(jī)的控制。二、實(shí)驗(yàn)設(shè)備.一臺(tái)裝有CCS軟件的計(jì)算機(jī);.DSP實(shí)驗(yàn)箱(插上電機(jī)模塊);.DSP硬件仿真器;.示波器。三、實(shí)驗(yàn)原理步進(jìn)電機(jī)工作原理,給步進(jìn)脈沖電機(jī)就轉(zhuǎn),不給脈沖電機(jī)就不轉(zhuǎn),步進(jìn)脈沖的頻率越高,步進(jìn)控制電機(jī)就轉(zhuǎn)的越快;改變各相的通電方式可以改變電機(jī)的運(yùn)行方式;改變通電順序可以控制步進(jìn)電機(jī)的運(yùn)行方式;改變通電順序可以控制步進(jìn)電機(jī)的正反轉(zhuǎn)。步進(jìn)電機(jī)的控制問(wèn)題可以總結(jié)為兩點(diǎn):1. 產(chǎn)生工作方式需要的時(shí)序脈沖;2. 控制步進(jìn)電機(jī)的速度使它始終遵循加速-勻速-減速的規(guī)律工作。對(duì)于I/O口有二類(lèi)寄存器:1. 控制寄存器和數(shù)據(jù)方向寄存器,使用方法如下:首先確定引腳的功能,即IO控制器寄存器,為1表示引腳功能是原模塊的功能,否則為IO功能。2. 如果引腳被配置為IO功能,就需要確定它的方向:輸入還是輸出,。為1表示是輸出引腳,否則是輸入引腳。對(duì)于IO功能的輸入或輸出是通過(guò)讀寫(xiě)相應(yīng)的數(shù)據(jù)方向寄存器來(lái)實(shí)現(xiàn)。輸入引腳對(duì)應(yīng)讀操作;輸出引腳對(duì)應(yīng)寫(xiě)操作。四、實(shí)驗(yàn)步驟1. 連接好DSP開(kāi)發(fā)系統(tǒng);2. 本實(shí)驗(yàn)工程文件(Example_stepmotor.pjt),編譯,下載程序到DSP;運(yùn)行程序,用觀察步進(jìn)電機(jī)運(yùn)行方向和速度的變化;五、實(shí)驗(yàn)心得體會(huì)通過(guò)本次實(shí)驗(yàn)對(duì)于2812通用的IO口進(jìn)一步熟悉實(shí)驗(yàn),使我基本掌握了2812通用的IO口的使用方法,加深了對(duì)IO口的認(rèn)識(shí)。本次實(shí)驗(yàn)的主要目的是通過(guò)2812對(duì)步進(jìn)機(jī)的的控制,開(kāi)始對(duì)于程序的設(shè)計(jì)沒(méi)有頭緒,通過(guò)查閱步進(jìn)機(jī)控制的原理,結(jié)合有關(guān)資料才正式設(shè)計(jì)出程序,基本掌握了2812對(duì)步進(jìn)機(jī)的控制,也更加熟悉了對(duì)DSP程序的設(shè)計(jì),受益匪淺。程序:#include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void delay_loop(void);void Gpio_select(void);/ Global variable for this exampleshort codetab17=0x0001,0x0002,0x0004,0x0008,0x0008,0x0004,0x0002,0x0001,0x0001,0x0002,0x0004,0x0008,0x0001,0x0002,0x0004,0x0008,0x0000;main() short i,j; / Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl();/ Specific clock setting for this example: EALLOW; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example/ For this example use the following configuration: Gpio_select();/ Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are cleared. / This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000;/ Initialize the PIE vector table with pointers to the shell Interrupt / Service Routines (ISR). / This will populate the entire table, even if the interrupt/ is not used in this example. This is useful for debug purposes./ The shell ISR routines are found in DSP281x_DefaultIsr.c./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_InitPeripherals.c/ InitPeripherals(); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: GpioDataRegs.GPADAT.all=0; Reg06=0x00; while(1) for(j=0;j400;j+) for(i=0;i4;i+) GpioDataRegs.GPADAT.all =codetabi; Reg06=0x00; delay_loop(); for(j=0;j400;j+) for(i=4;i8;i+) GpioDataRegs.GPADAT.all =codetabi; Reg06=0x00; delay_loop(); void delay_loop() short i,j; for (i = 0; i 1000; i+) for (j = 0; j 10; j+);void Gpio_select(void) Uint16 var1; Uint16 var2; Uint16 var3; var1= 0x0000;/ sets GPIO Muxs as I/Os var2= 0xFFFF;/ sets GPIO DIR as outputs var3= 0x0000;/ sets the Input qualifier values EALLOW; GpioMuxRegs.GPAMUX.all=var1; GpioMuxRegs.GPBMUX.all=var1; GpioMuxRegs.GPDMUX.all=var1; GpioMuxRegs.GPFMUX.all=var1; GpioMuxRegs.GPEMUX.all=var1; GpioMuxRegs.GPGMUX.all=var1;GpioMuxRegs.GPADIR.all=var2;/ GPIO PORTs as output GpioMuxRegs.GPBDIR.all=var2; / GPIO DIR select GPIOs as output GpioMuxRegs.GPDDIR.all=var2; GpioMuxRegs.GPEDIR.all=var2; GpioMuxRegs.GPFDIR.all=var2; GpioMuxRegs.GPGDIR.all=var2; GpioMuxRegs.GPAQUAL.all=var3; / Set GPIO input qualifier values GpioMuxRegs.GPBQUAL.all=var3; GpioMuxRegs.GPDQUAL.all=var3; GpioMuxRegs.GPEQUAL.all=var3; EDIS; /=/ No more./=一、實(shí)驗(yàn)?zāi)康?. 要求學(xué)生掌握2812 PWM的使用方法;2. 掌握2812對(duì)直流電機(jī)的控制。二、實(shí)驗(yàn)設(shè)備.一臺(tái)裝有CCS軟件的計(jì)算機(jī);.DSP實(shí)驗(yàn)箱;.DSP硬件仿真器;.示波器。三、實(shí)驗(yàn)原理電機(jī)模塊的原理圖如下四、實(shí)驗(yàn)步驟3. 連接好DSP開(kāi)發(fā)系統(tǒng);4. 本實(shí)驗(yàn)工程文件(Example_dcmotor.pjt),編譯,下載程序到DSP;5. 運(yùn)行程序,用觀察直流電機(jī)運(yùn)行方向和速度的變化;五、實(shí)驗(yàn)心得體會(huì)通過(guò)本次實(shí)驗(yàn),認(rèn)識(shí)了PWM的使用方法,通過(guò)親身體驗(yàn),初步掌握了2812對(duì)PWM的控制使用方法,加深了對(duì)PWM的認(rèn)識(shí)。本次實(shí)驗(yàn)的主要目的是通過(guò)2812對(duì)直流電機(jī)的控制,開(kāi)始對(duì)于程序的設(shè)計(jì)沒(méi)有頭緒,通過(guò)查閱直流電機(jī)的原理,結(jié)合有關(guān)資料才正式設(shè)計(jì)出程序,基本掌握了2812對(duì)直流電機(jī)的控制,也更加熟悉了對(duì)DSP程序的設(shè)計(jì),受益匪淺。附:實(shí)驗(yàn)程序:#include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void init_eva(void);void init_evb(void);void delay_loop();/ Global variable for this examplemain() unsigned short i;/ Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl();/ Specific clock setting for this example: EALLOW; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example/ Initialize only GPAMUX and GPBMUX for this test EALLOW; / Enable PWM pins GpioMuxRegs.GPAMUX.all = 0x00FF; / EVA PWM 1-6 pins GpioMuxRegs.GPBMUX.all = 0x00FF; / EVB PWM 7-12 pins EDIS;/ Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are cleared. / This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000;/ Initialize the PIE vector table with pointers to the shell Interrupt / Service Routines (ISR). / This will populate the entire table, even if the interrupt/ is not used in this example. This is useful for debug purposes./ The shell ISR routines are found in DSP281x_DefaultIsr.c./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_InitPeripherals.c/ InitPeripherals(); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: init_eva(); /init_evb(); while(1) for(i=0;i65535;i+=1000) Reg06=0; EvbRegs.CMPR6 = i; delay_loop(); void delay_loop() short i,j; for (i = 0; i 1000; i+) for (j = 0; j 10; j+);void init_eva()/ EVA Configure T1PWM, T2PWM, PWM1-PWM6 / Initalize the timers / Initalize EVA Timer1 EvaRegs.T1PR = 0xFFFF; / Timer1 period EvaRegs.T1CMPR = 0x3C00; / Timer1 compare EvaRegs.T1CNT = 0x0000; / Timer1 counter / TMODE = continuous up/down / Timer enable / Timer compare enable EvaRegs.T1CON.all = 0x1042; / Initalize EVA Timer2 EvaRegs.T2PR = 0x0FFF; / Timer2 period EvaRegs.T2CMPR = 0x03C0; / Timer2 compare EvaRegs.T2CNT = 0x0000; / Timer2 counter / TMODE = continuous up/down / Timer enable / Timer compare enable EvaRegs.T2CON.all = 0x1042; / Setup T1PWM and T2PWM / Drive T1/T2 PWM by compare logic EvaRegs.GPTCONA.bit.TCMPOE = 1; / Polarity of GP Timer 1 Compare = Active low EvaRegs.GPTCONA.bit.T1PIN = 1; / Polarity of GP Timer 2 Compare = Active high EvaRegs.GPTCONA.bit.T2PIN = 2; / Enable compare for PWM1-PWM6 /EvaRegs.CMPR1 = 0

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論