3.22EjemploDRM007 Co..
3.22EjemploDRM007 Co..
3.22EjemploDRM007 Co..
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Source <strong>Co</strong>de<br />
Source <strong>Co</strong>de Files<br />
void InitPWMMC(void)<br />
{<br />
PMOD = PWMFREQ;<br />
// Frequency of 15.625 KHz<br />
#ifdef MOS_3_COM<br />
PVAL1 = PWMOFF;<br />
PVAL3 = PWMOFF;<br />
PVAL5 = PWMOFF;<br />
DEADTM = DEADTIME;<br />
#endif<br />
#ifdef MOS_2_COM<br />
PVAL1 = PWMON;<br />
PVAL3 = PWMON;<br />
PVAL5 = PWMON;<br />
PVAL2 = PWMOFF;<br />
PVAL4 = PWMOFF;<br />
PVAL6 = PWMOFF;<br />
#endif<br />
PCTL2 = RELOAD_1;<br />
PCTL1 = PWMEN;<br />
/* Reload every 4 PWM cycle. Fop=Fbus=8000000 Hz.<br />
PWMFreq = 8MHz / (2*256) = 15.625 kHz<br />
Reload Freq = 15.625 kHz / 4 = 3.90625 kHz */<br />
// Turn on PWM module<br />
PCTL1 |= LDOK;<br />
}<br />
return;<br />
/*****************************************************************************\<br />
* void stop_motor (void): The motor is stopped in this subroutine, either * *<br />
for user command or motor stalled. *<br />
* *<br />
* Parameters: None. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
void StopMotor(void)<br />
{<br />
extern<br />
UBYTE BLDCState;<br />
InitTimerA();<br />
InitTimerB();<br />
BLDCState = BLDCSTOP;<br />
#ifdef MOS_3_COM<br />
BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />
DRM007<br />
MOTOROLA Source <strong>Co</strong>de 143