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 />
TurnOffAllPWMOutputs();<br />
PVAL1 = PWMOFF;<br />
PVAL3 = PWMOFF;<br />
PVAL5 = PWMOFF;<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 />
PCTL1 |= LDOK;<br />
}<br />
return;<br />
/*****************************************************************************\<br />
* void init_PLL (void): PLL is initialized to run at 8 MHz of Bus frequency *<br />
* *<br />
* Parameters: None. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
void InitPLL(void) // Fbus = 8000000 +/- 2% Hz<br />
{<br />
PCTL &= ~BCS;<br />
// select external reference as base clock<br />
PCTL &= ~PLLON;<br />
// turn off PLL<br />
PPG = 0x86;<br />
// program N and L<br />
PBWC |= AUTO;<br />
// enable automatic bandwidth control<br />
PCTL |= PLLON;<br />
// turn on PLL<br />
while((PBWC & LOCK)==0); // wait for PLL to lock<br />
PCTL |= BCS;<br />
return;<br />
}<br />
/*****************************************************************************\<br />
* interrupt void Fault1_ISR(void): Interrupt handler subroutine for Fault1. *<br />
* The motor is stopped when a FAULT occurs. *<br />
* The FAULT is asserted when the current *<br />
* limit or voltage limit has been reached by *<br />
* the power stage. *<br />
* *<br />
* Parameters: None. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
DRM007<br />
BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />
144 Source <strong>Co</strong>de MOTOROLA