MEP scale factor from optimizer sw MPYU PTAL P T AL Optimizer scaling MOVH ALP

Mep scale factor from optimizer sw mpyu ptal p t al

This preview shows page 19 - 22 out of 34 pages.

; MEP scale factor (from optimizer s/w) MPYU P,T,@AL ; P <= T * AL, Optimizer scaling MOVH @AL,P ; AL <= P, move result back to ACC ADD ACC, #0x180 ; MEP range and rounding adjustment MOVL *XAR3,ACC ; CMPA:CMPAHR(31:8) <= ACC ; Output for EPWM1B (Regular Res) Optional - for comparison purpose only MOV *+XAR3[2],AH ; Store ACCH to regular CMPB SPRUG02–February 2009 High-Resolution Pulse Width Modulator (HRPWM) 19 Submit Documentation Feedback
Image of page 19
2.5.2 Implementing a DAC function Using an R+C Reconstruction Filter EPWM1A V OUT1 LPF EPWM1A CA T PWM = 2.5 μ S Z CA Z Z Operational Description of HRPWM In this example, the PWM requirements are: PWM frequency = 400 kHz (i.e. TBPRD = 250) PWM mode = Asymmetrical, Up-count Resolution = 14 bits ( MEP step size = 150 ps) Figure 10 and Figure 11 show the DAC function and the required PWM waveform. As explained previously, configuration for the ePWM1 module is almost identical to the normal case except that the appropriate MEP options need to be enabled/selected. Figure 10. Simple Reconstruction Filter for a PWM Based DAC Figure 11. PWM Waveform Generated for the PWM DAC Function The example code shown consists of two main parts: Initialization code (executed once) Run time code (typically executed within an ISR) This example assumes a typical MEP_SP and does not use the SFO library. Example 4 shows the Initialization code. The first part is configured for conventional PWM. The second part sets up the HRPWM resources.