1699 views|0 replies

1140

Posts

0

Resources
The OP
 

TMS320F2812 complete program to implement SVPWM [Copy link]

//###########################################################################
//
// FILE: DSP281x_Ev.c
//
// TITLE: DSP281x Event Manager Initialization & Support Functions.
//
//###########################################################################
//
// Ver | dd mmm yyyy | Who | Description of changes
// =====|=============|======|===============================================
// 1.00| 11 Sep 2003 | L.H. | No change since previous version (v.58 Alpha)
//###########################################################################

#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File

//---------------------------------------------------------------------------
// InitEv:
//---------------------------------------------------------------------------
// This function initializes to a known state.
//
void InitEv(void)
{
EALLOW;
// Initalize EVA Timer1&Configure PWM1-PWM6
//EvaRegs.T1PR = 625; // period=625×2/25M ,PWM=20KHz
EvaRegs.T1PR = 781; // period=781×2/25M ,PWM=16KHz
EvaRegs.T1CNT = 0; // Timer1 counter

//Timer control register A
EvaRegs.GPTCONA.bit.TCMPOE=1; // enable timer compare
EvaRegs.GPTCONA.bit.T1PIN=0; // timer compare output
//Timer compare register
EvaRegs.T1CMPR=0;

EvaRegs.EVAIMRA.bit.T1UFINT = 1;// enable Timer1 period interrupt
//EVA interrupt mask register
EvaRegs.EVAIFRA.bit.T1UFINT=1; // clear Timer1 period interrupt flag
//EVA interrupt flag register
/****************************************************
TMODE = continuous up/down count
Input clock prescaler= X/1 (X=HSPCLK)=25MHz
Timer enable ; Timer compare enable
*********************************************************/
EvaRegs.T1CON.all = 0x0802; // continuous increase and decrease count, X/1 timer is not turned on
//Enable compare for PWM1-PWM6
EvaRegs.CMPR1 = 781;
EvaRegs.CMPR2 = 781;
EvaRegs.CMPR3 = 781;

EvaRegs.ACTRA.all = 0x0999; // PWM1,2,3,4,5,6
EvaRegs.DBTCONA.all = 0x0AEC; // Dead zone 2.88us 9/(25/8)
EvaRegs.COMCONA.all = 0xa600; // Enable comparison operation, disable global comparison output
//****************** QEP initialization ********************
// EvbRegs.T4CON.all=0x1870;
// EvbRegs.T4CNT=0x0000;
// EvbRegs.T4PR=0xffff;

EvaRegs.T2CON.all=0x1870;
EvaRegs.T2CNT=0x0000;
EvaRegs.T2PR=0xffff;

EvaRegs.T1CON.bit.TENABLE=0;
//****************************************************
EDIS;
}

//===========================================================================
// No more.
//================

SVPWM_2812.rar (741.71 KB, downloads: 29)

This post is from DSP and ARM Processors
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list