21.01.2014 Views

3.22EjemploDRM007 Co..

3.22EjemploDRM007 Co..

3.22EjemploDRM007 Co..

SHOW MORE
SHOW LESS

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

else<br />

{<br />

if((PORTB & OPTIONS_BUTTON) == 0x00)<br />

{<br />

WaitUntilUpButtonIsReleased();<br />

return OPTIONS_BUTTON;<br />

}<br />

asm BIH no_button_pressed;<br />

DebounceDelay();<br />

asm BIH no_button_pressed;<br />

asm button_pressed: /* Wait until DOWN button is released */<br />

asm BIL button_pressed;<br />

return ENTER_BUTTON;<br />

asm no_button_pressed:<br />

}<br />

/* For displaying the actual and desired speed select this message.<br />

This algorithm converts a UBYTE value to ASCII values suitable for<br />

the LCD display */<br />

if ((LCDState == SPEED))<br />

{<br />

if (RefSpeed < 0)<br />

{<br />

buffer = (UBYTE)(-RefSpeed);<br />

StringLCD("DES-");<br />

}<br />

else<br />

{<br />

buffer = (UBYTE)RefSpeed;<br />

StringLCD("DES+");<br />

}<br />

DataLCD((UBYTE)(((buffer * 31) / 100) / 10) + '0');<br />

DataLCD((UBYTE)(((buffer * 31) / 100) % 10) + '0');<br />

DataLCD((UBYTE)(((buffer * 31) % 100) / 10) + '0');<br />

if (Speed < 0)<br />

{<br />

buffer = (UBYTE)(-Speed);<br />

StringLCD("0 CU-");<br />

}<br />

else<br />

{<br />

buffer = (UBYTE)Speed;<br />

StringLCD("0 CU+");<br />

}<br />

DataLCD((UBYTE)(((buffer * 31) / 100) / 10) + '0');<br />

DataLCD((UBYTE)(((buffer * 31) / 100) % 10) + '0');<br />

DataLCD((UBYTE)(((buffer * 31) % 100) / 10) + '0');<br />

DRM007<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!