//EnablePWMpins;GpioMuxRegs.GPAMUX.all=0;GpioMuxRegs.GPBMUX.all=0;EDIS;;//Step3.Clearallinterrup;//DisableCPUinterrupts;DINT;;//InitializethePIEcontro;//ThedefaultstateisallPI;//ar
// 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;i<65535;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 = 0x0C00;
//EvaRegs.CMPR2 = 0x3C00;
EvaRegs.CMPR3 = 0xFC00;
// Compare action control. Action that takes place
// on a cmpare event
// output pin 1 CMPR1 - active high
// output pin 2 CMPR1 - active low
// output pin 3 CMPR2 - active high
// output pin 4 CMPR2 - active low
// output pin 5 CMPR3 - active high
// output pin 6 CMPR3 - active low
EvaRegs.ACTRA.all = 0x0666;
EvaRegs.DBTCONA.all = 0x0000; // Disable deadband
EvaRegs.COMCONA.all = 0xA600;
}
void init_evb
{
// EVB Configure T3PWM, T4PWM and PWM7-PWM12
// Step 1 - Initialize the Timers
// Initialize EVB Timer3
// Timer3 controls T3PWM and PWM7-12
EvbRegs.T3PR = 0xFFFF; // Timer3 period
EvbRegs.T3CMPR = 0x3C00; // Timer3 compare
EvbRegs.T3CNT = 0x0000; // Timer3 counter
// TMODE = continuous up/down
// Timer enable
// Timer compare enable
EvbRegs.T3CON.all = 0x1042;
// Initialize EVB Timer4
// Timer4 controls T4PWM
EvbRegs.T4PR = 0x00FF; // Timer4 period
EvbRegs.T4CMPR = 0x0030; // Timer4 compare
EvbRegs.T4CNT = 0x0000; // Timer4 counter
// TMODE = continuous up/down
// Timer enable
// Timer compare enable
EvbRegs.T4CON.all = 0x1042;
// Setup T3PWM and T4PWM
// Drive T3/T4 PWM by compare logic
EvbRegs.GPTCONB.bit.TCMPOE = 1;
// Polarity of GP Timer 3 Compare = Active low
EvbRegs.GPTCONB.bit.T3PIN = 1;
// Polarity of GP Timer 4 Compare = Active high
EvbRegs.GPTCONB.bit.T4PIN = 2;
// Enable compare for PWM7-PWM12
EvbRegs.CMPR4 = 0x0C00;
EvbRegs.CMPR5 = 0x3C00;
EvbRegs.CMPR6 = 0xFC00;
// Compare action control. Action that takes place
// on a cmpare event
// output pin 1 CMPR4 - active high
// output pin 2 CMPR4 - active low
// output pin 3 CMPR5 - active high
// output pin 4 CMPR5 - active low
// output pin 5 CMPR6 - active high
// output pin 6 CMPR6 - active low
EvbRegs.ACTRB.all = 0x0666;
EvbRegs.DBTCONB.all = 0x0000; // Disable deadband
EvbRegs.COMCONB.all = 0xA600;
}
龙 岩 学 院
实 验 报 告
班 级 07电本(1)班 学号 20xx050344 姓 名 杨宝辉 同组人 实验日期 20xx-6-3 室温 大气压 成 绩
高速A/D转换实验
一、实验目的
1.了解高速 AD工作的基本原理。
2.了解如果通过软件正确的控制高速AD。
3.掌握对高速 AD正确操作的过程
二、实验设备
1. 一台装有CCS软件的计算机;
2. DSP实验箱;
3. DSP硬件仿真器;
三、实验原理
实验箱用的高速 AD 为 TLC5510,它是一个 CMOS 结构的、具有高达20MSPS 的8位模数转换器。TLC5510 采用单5V 供电,功耗仅为 130mW。TLC5510 内部包含有一个采样保持电路、具有高阻输出的并行接口以及内部参考电压等。
TLC5510 采用半 FlASh 结构,与 FlASh 结构相比,它不仅减少了功耗,而且提高了芯片的集成度。TLC5510 采用两步转换实现一次完整的转换,这样就大大减少了内部比较器的个数,其输出数据的延迟为2.5个时钟周期。TLC5510 采用 3 个内部参考电阻产生一个标准2V的参考电压,要实现内部参考电压仅需要通过外部的简单连线即可。