3.22EjemploDRM007 Co..
3.22EjemploDRM007 Co..
3.22EjemploDRM007 Co..
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Source <strong>Co</strong>de<br />
/*****************************************************************************\<br />
* void init_LCD(void): Subroutine to initialize the LCD character display for *<br />
* 4-bit operation, blink off, display on. *<br />
* *<br />
* Parameters: None. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
void InitLCD(void)<br />
{<br />
/* Sequence followed for LCD initialization */<br />
// In 8 bit operation mode<br />
WaitMs(15);<br />
Ctrl8LCD(0x03); // Set 8 bit operation<br />
WaitMs(5);<br />
Ctrl8LCD(0x03); // Set 8 bit operation<br />
WaitMs(1);<br />
Ctrl8LCD(0x03); // Set 8 bit operation<br />
Ctrl8LCD(0x02); // Set 4 bit operation<br />
}<br />
// In 4 bit operation mode<br />
CtrlLCD(0x28); // 4 bit operation with 2 line display<br />
CtrlLCD(0x06); // No display shift and move right<br />
CtrlLCD(0x01); // Clear display and return home position<br />
CtrlLCD(0x0C); // Display on, cursor off and blink off<br />
return;<br />
/*****************************************************************************\<br />
* void ctrl_LCD(void): Subroutine for sending control bytes to the LCD. This<br />
*<br />
* routine send the 8 bit value in two parts, since this *<br />
* function is called in 4 bit operation mode. *<br />
* *<br />
* Parameters: ctrl. An 8 bit value for different control of the LCD, such as *<br />
* number of lines, blink on or off, etc. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
void CtrlLCD(UBYTE ctrl)<br />
{<br />
// Upper Nibble<br />
PORTA &= 0xF0;<br />
// puting pin states of the LCD in PORTA pins<br />
PORTA |= (ctrl >> 4) & 0x0F;<br />
Set_E();<br />
Clear_E();<br />
DRM007<br />
BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />
146 Source <strong>Co</strong>de MOTOROLA