教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 政务民生 >

28335 - DSP实验报告(2)

来源:网络收集 时间:2026-01-30
导读: 研究生实验报告 四、实验结果和分析 1、软件调试结果 图11 900Hz 1200mV正弦波调试结果 (上图) 图12 1700Hz 800mV正弦波调试结果 (上图) 图13 800Hz 1000mV三角波调试结果 (上图) 2、结果分析 (1)从图11所示的调试

研究生实验报告

四、实验结果和分析

1、软件调试结果

图11 900Hz 1200mV正弦波调试结果 (上图)

图12 1700Hz 800mV正弦波调试结果 (上图)

图13 800Hz 1000mV三角波调试结果 (上图)

2、结果分析

(1)从图11所示的调试结果波形图可以看出,滤波后的波形平滑度明显变好,说明低

通滤波效果良好。各个波形参数MIN(最小值)、MAX(最大值)、VRM(有效值)、FRE(频率)、 PER(周期)均和实际输入的指标误差在

5

研究生实验报告

5%以内,说明电参量的计算方法准确性良好。

(2)从图12所示的实验波形可以看出,当输入波形的电参量变化时,输出电参量的值也发生了相同变化,且误差值在5%以内。由ADC的采样频率可以得到,本程序可以计算出频率最低为150Hz的正弦波的周期。

(3)比较图13和前两幅波形可以得出,本程序在对三角波进行采样时,波形滤波效果良好,电参量计算准确,也达到了良好的效果。由此验证了本程序的通用性,并进一步验证了程序的准确性。

(4)通过实验结果总结出本程序在以下方面需要进一步改进:AD采样的速率以及采样窗口的大小目前为确定值,当波形频率变化范围较大时,会影响到采样的结果,如:当频率过大时,采样波形每个周期的点数减小,将直接影响各个电参量的计算结果;当频率过小时,采样的窗口不能采样出一个完整的波形周期,也将直接影响各个电参量的计算结果。这是需要进一步作出改进的地方。

五、源程序

#include \ // DSP2833x Headerfile Include File

#include File

\ // DSP2833x Examples Include #include \

// Prototype statements for functions found within this file. interrupt void adc_isr(void); interrupt void ISRTimer2(void); void number_count(void); 并发送数据 //确定周期采样点,计算频率和有效值void scib_fifo_init(); void InitScibGpio(void);

//串口初始化程序

void number_C(unsigned long i); //数字各位拆分函数

#if (CPU_FRQ_150MHZ) // Default - 150 MHz SYSCLKOUT #define ADC_MODCLK 0x3 // HSPCLK

=

SYSCLKOUT/2*ADC_MODCLK2 = 150/(2*3) = 25.0 MHz #endif

#if (CPU_FRQ_100MHZ)

SYSCLKOUT/2*ADC_MODCLK2 = 100/(2*2) #define ADC_MODCLK 0x2 // = 25.0 MHz HSPCLK = #endif

#define HSPCLK/2*ADC_CKPS ADC_CKPS = 25.0MHz/(1*2) = 12.5MHz

0x1 // ADC module clock = #define ADC_SHCLK 0xf // S/H width in ADC module periods = 16 ADC clocks

#define AVG 1000 // Average sample limit #define ZOFFSET 0x00 // Average Zero offset #define BUF_SIZE 160 // Sample buffer size

//Global variables used in this example: Uint16 LoopCount; Uint16 ConversionCount; Uint16 Voltage1[1024]; Uint16 i = 0; Uint16 j = 0; Uint16 Ticker[50];

//在AD采样的例程基础上修改,以下为新定义的变量: Uint16 ADt1,ADt2,ADt,ADt3,ADt4;//AD时间间隔 Uint16 Voltagelb[1024]; Uint16 vref=500; //参考值 int PreConversion=0; int crosszero=0;

Uint32 t1,t2,t,t3,t4;//定时器时间间隔 float Data=0.0; float Vavg=0.0;//平均值 float Vmax=0.0;//最大值

float Vmin=0.0;//最小值 float Vrms=0.0;//有效值 float Vpp=0.0;//峰峰值 float frequency=0; float period=0; float MAX=0.0; float MIN=0.0;

//以下为整型变量,用于串口发送 Uint16 T=0;//周期ms Uint16 F=0;//

6

研究生实验报告

Uint16 V=0;//有效值mv Uint16 max=0;//最大值mv Uint16 min=0;//最小值mv unsigned int TX_flag = 0; //串口发送时间间隔标志 unsigned int TX_Ticker = 500; //串口发送的周期间隔 main() { // Step 1. Initialize System Control: // PLL, WatchDog, enable Peripheral Clocks // This example function is found in the DSP2833x_SysCtrl.c file. InitSysCtrl(); // Step 2. Initialize GPIO: // This example function is found in the DSP2833x_Gpio.c file and // illustrates how to set the GPIO to it's default state. InitGpio(); // Skipped for this example InitScibGpio();//*********************起初遗漏了这句话************************** // 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 DSP2833x_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 DSP2833x_DefaultIsr.c. // This function is found in DSP2833x_PieVect.c. InitPieVectTable(); // Interrupts that are used in this example are re-mapped to // ISR functions found within this file. EALLOW; // This is needed to write to EALLOW protected register PieVectTable.ADCINT = &adc_isr; PieVectTable.TINT2 = &ISRTimer2; EDIS; InitXintf(); /*设置CPU*/ InitCpuTimers(); ConfigCpuTimer(&CpuTimer2, 150, 10);//中断时间10us. 1MHz StartCpuTimer2(); CpuTimer2Regs.TCR.all = 0x4001; // Use write-only instruction to set TSS bit = 0 /*开中断*/ IER |= M_INT14; // Enable TINT0 in the PIE: Group 1 interrupt 7 PieCtrlRegs.PIEIER1.bit.INTx7 = 1; // Step 4. Initialize all the Device Peripherals: // This function is found in DSP2833x_InitPeripherals.c // InitPeripherals(); // Not required for this example InitAdc(); // For this example, init the ADC scib_fifo_init(); // Step 5. User specific code, enable interrupts: // Enable ADCINT in PIE PieCtrlRegs.PIEIER1.bit.INTx6 = 1; IER |= M_INT1; // Enable CPU Interrupt 1 EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM LoopCount = 0; ConversionCount = 0; AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK; AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS; AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; …… 此处隐藏:5794字,全部文档内容请下载后查看。喜欢就下载吧 ……

28335 - DSP实验报告(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/447357.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)