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

EnableInterrupts();<br />

do<br />

{<br />

/* At this point of the endless main loop,<br />

a new string of the main menu is displayed<br />

in the LCD for user interface */<br />

CtrlLCD(CLEARLCD);<br />

StringLCD((UBYTE *)(MSGS[LCDState]));<br />

/* This function call doesn't return until<br />

one of the two buttons is pressed and<br />

released */<br />

botpressed = ResolveButtons();<br />

/* The LEFT button is used for changing the LCD<br />

message for other system functions, such as<br />

varying BLDC and FAN DC speed, starting and<br />

stopping both motors, etc. */<br />

if (botpressed == OPTIONS_BUTTON)<br />

{<br />

LCDState = (UBYTE)(LCDState + 1);<br />

if (LCDState == MAXLCDMSGS) LCDState = BLDC_WASH;<br />

}<br />

/* The RIGHT button is used for selecting the<br />

current function displayed in the LCD */<br />

else if (botpressed == ENTER_BUTTON)<br />

{<br />

/* Function 1. Wash function for a washing machine<br />

is selected here. */<br />

if(LCDState == BLDC_WASH)<br />

{<br />

if(BLDCState == BLDCSTOP)<br />

{<br />

LCDState = BLDC_STOP;<br />

InitMotor(BLDCWASH);<br />

}<br />

}<br />

DRM007<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!