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 />

Wait40us();<br />

// Lower Nibble<br />

PORTA &= 0xF0;<br />

PORTA |= ctrl & 0x0F;<br />

Set_E();<br />

Clear_E();<br />

// puting pin states of the LCD in PORTA pins<br />

if ((ctrl==0x01) || (ctrl==0x02)) WaitMs(2);<br />

Wait40us();<br />

}<br />

return;<br />

/*****************************************************************************\<br />

* void ctrl8LCD(void): Subroutine for sending control bytes to the LCD in 8 *<br />

* bit mode. use this function only to enter 4-bit mode, *<br />

* since the other 4 data pins have no connection *<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 Ctrl8LCD(UBYTE ctrl)<br />

{<br />

PORTA &= 0xF0;<br />

PORTA |= ctrl & 0x0F;<br />

Set_E();<br />

Clear_E();<br />

// puting pin states of the LCD in PORTA pins<br />

}<br />

Wait40us();<br />

return;<br />

/*****************************************************************************\<br />

* void mov_cursor_LCD(UBYTE places, UBYTE dir): subroutine to move the LCD *<br />

* cursor to RIGHT or LEFT the *<br />

* the number of places the user *<br />

* wants specyfied in 'places' *<br />

* *<br />

* Parameters: places. Number of places wanted to move the LCD cursor without *<br />

* affecting any LCD actual message. *<br />

* dir. Direction in which the cursor is to be moved. RIGHT or *<br />

* LEFT. *<br />

* *<br />

* Return: None. *<br />

\*****************************************************************************/<br />

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

DRM007<br />

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

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

Saved successfully!

Ooh no, something went wrong!