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 />
/*****************************************************************************\<br />
* void main(void): This function includes MCU and its peripherals *<br />
* configuration. Also an endless loop for the main menu *<br />
* in the LCD display for user interface *<br />
* *<br />
* Parameters: None. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
void main(void) {<br />
extern UBYTE Required_Direction;<br />
UBYTE botpressed;<br />
/* This variable is used to store the key<br />
pressed by the user */<br />
// MCU init<br />
#ifdef MOS_3_COM<br />
MOR = CENTER_ALIGNED | COMPLEMENTARY_MODE | COP_DISABLE;<br />
#endif<br />
#ifdef MOS_2_COM<br />
DISMAP = 0x20;<br />
MOR = CENTER_ALIGNED | TOPNEG | INDEPENDENT_PWMS | COP_DISABLE;<br />
#endif<br />
ISCR = IMASK;<br />
FCR = FAULT_1_MANUAL | FAULT_1_INT;<br />
InitPLL();<br />
InitPWMMC();<br />
// Port init<br />
PORTA = 0x00;<br />
PORTB = 0x00;<br />
PORTC = 0x00;<br />
DDRA = 0x0F;<br />
DDRB = 0x04;<br />
DDRC = 0x02;<br />
WaitMs(250);<br />
InitLCD();<br />
InitTimerA();<br />
InitTimerB();<br />
BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />
DRM007<br />
MOTOROLA Source <strong>Co</strong>de 123