21.01.2014 Views

3.22EjemploDRM007 Co..

3.22EjemploDRM007 Co..

3.22EjemploDRM007 Co..

SHOW MORE
SHOW LESS

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 InitMotor(UBYTE <strong>Co</strong>mmanded_Operation)<br />

{<br />

extern UBYTE BLDCState;<br />

BLDCState = <strong>Co</strong>mmanded_Operation;<br />

/* Initialize Reference speed and pointers to tables */<br />

if (BLDCState == BLDCWASH)<br />

{<br />

WASHTable_Index = 0;<br />

RefSpeed = WASHTable[WASHTable_Index++];<br />

}<br />

else<br />

{<br />

SPINTable_Index = 0;<br />

RefSpeed = SPINTable[SPINTable_Index++];<br />

if (Required_Direction == CCW)<br />

RefSpeed = -RefSpeed;<br />

}<br />

/* Initialize variables used for motor control and speed calculation */<br />

Actual_Capture = MAXPERIOD;<br />

Past_Capture = 0;<br />

I_PortionK_1 = 0;<br />

Milli_<strong>Co</strong>unter = 0;<br />

Time_Out = 0;<br />

/* Charge bootstrap capacitors*/<br />

#ifdef MOS_3_COM<br />

PVAL1 = PWMOFF;<br />

PVAL3 = PWMOFF;<br />

PVAL5 = PWMOFF;<br />

PCTL1 |= LDOK;<br />

Turn_On_Low_Side_MOSFETs();<br />

WaitMs(10);<br />

PWMOUT = 0x00;<br />

#endif<br />

#ifdef MOS_2_COM<br />

PVAL1 = PWMON;<br />

PVAL3 = PWMON;<br />

PVAL5 = PWMON;<br />

PVAL2 = PWMON;<br />

PVAL4 = PWMON;<br />

PVAL6 = PWMON;<br />

PCTL1 |= LDOK;<br />

WaitMs(10);<br />

PVAL2 = PWMOFF;<br />

PVAL4 = PWMOFF;<br />

PVAL6 = PWMOFF;<br />

PCTL1 |= LDOK;<br />

BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />

DRM007<br />

MOTOROLA Source <strong>Co</strong>de 129

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!