Pulse 280 Specifications Page 37

  • Download
  • Add to my manuals
  • Print
  • Page
    / 42
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 36
www.ti.com
Software Usage
Step 1. Add "Include" Files
The SFO_V5.h file needs to be included as follows. This include file is mandatory when using the SFO V5
library functions. For the TMS320F28044 device, the C2804x C/C++ Header Files and Peripheral
Examples (literature number SPRC324) DSP2804x_Device.h and DSP2804x_PWM_defines.h files are
necessary as will, as they are used by all TI software examples for the device. These file names will
change in accordance with your specific device. These include files are optional if customized header files
are used in the end application. See example below.
Example 1. A Sample of How to Add "Include" Files
#include "DSP2804x_Device.h" //DSP2804x Headerfile
#include "DSP2804x_EPWM_defines.h" //init defines
#include "SFO_V5.h" //SFO V5 lib functions (needed for HRPWM)
Step 2. Define Number of HRPWM Channels Used
In the SFO_V5.h file, the maximum number of HRPWM's used for a peticular device must be defines.
PWM_CH must equal the number of HRPWM channels plus one. For instance, for the TMS320F28044
where there are 16 possible HRPWM channels, PWM_CH can be set to 17. For the TMS320F2809,
where there are 6 possible HRPWM channnels, PWM_CH can be set to 7. See example below.
To save static variable memory, fewer than the maximum number of HRPWM channels may be defined
with some caution. To do this, PWM_CH can be set to the largest ePWM channel number plus one. For
instance, if only ePWM1A and ePWM2A channels are required as HRPWM channels, PWM_CH can be
set to 3. However, if only ePWM15A and ePWM16A channels are required as HRPWM channels,
PWM_CH must still be set to 17.
Example 2. Defining Number of HRPWM Channels Used (Plus One)
//SFO_V5.H
//NOTE: THIS IS A VERY IMPORTANT STEP> PWM_CH MUST BE DEFINED FIRST BEFORE
//BUILDING CODE
#define PWM_CH 17
//F28044 has a maximum of 16 HRPWM channels (17=16+1)
//For a device with maximum of 6 HRPWM channels, PWM_CH = 7
//For a device with maximum of 4 HRPWM channels, PWM_CH = 5
//For a device with maximum of 3 HRPWM channels, PWM_CH = 4
Step 3. Element Declaration
Declare an array of integer variables with a length equal to PWM_CH, and an array of pointers to EPWM
register structures. The array of pointers will include pointers for up to 16 EPWM register structures plus
one dummy pointer in location EPWM[0] for a device with 16 EPWM channels. Likewise, it will include
pointers for up to 3 EPWM register structures plus one for a device with three EPWM registers.
Example 3. Declaring Elements Required by SFO_TI_Build_V5.lib
int MEP_ScaleFactor[PWM_CH] = {0,0,0,0,0, //Scale factor values for ePWM 1-16
0,0,0,0, //and MEP_ScaleFactor[0]
0,0,0,0, //For Fewer HRPWM channels, these
0,0,0,0}; //will be fewer zeros initialized
//Declare a volatile array of pointers to EPWM register structures.
//Only point to registers that exist. If a device has only 6 EPWMs (PWM_CH is 7),
//the array will include pointers for up to 6 EPWM register structures plus one
//dummy pointer in the ePWM[0] location.
volatile struct EPWM_REGS *ePWM[PWM_CH] {0, &EPwm1Regs, &EPwm2Regs,
&EPwm3Regs, &EPwm4Regs, &EPwm5Regs, &EPwm6Regs, &EPwm7Regs,
37
SPRU924F April 2005 Revised October 2011 SFO Library Software - SFO_TI_Build_V5.lib
Submit Documentation Feedback
Copyright © 20052011, Texas Instruments Incorporated
Page view 36
1 2 ... 32 33 34 35 36 37 38 39 40 41 42

Comments to this Manuals

No comments