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

Source <strong>Co</strong>de Files<br />

else<br />

{<br />

}<br />

{<br />

}<br />

StopMotor();<br />

FAULTState = MOTOR_STALLED;<br />

/* If 8 timeout has completed, a motor stalled protection action is<br />

taken, calling subroutine NextSequence instead of being called from<br />

a Hall Effect Sensor Interrupt */<br />

if ((Time_Out & 0x07) == 0)<br />

{<br />

TempHalls = HallSensorInputs();<br />

NextSequence();<br />

}<br />

}<br />

return;<br />

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

* interrupt void HALL_A_ISR(void): Interrupt handler subroutine for driving *<br />

* Hall A input signal. in this interrupts *<br />

* is called NextSequence Subroutine for *<br />

* commuting the BLDC motor *<br />

* *<br />

* Parameters: None. *<br />

* *<br />

* Return: None. *<br />

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

interrupt void HallA_ISR (void) // 160 max, 148 typ<br />

{<br />

TASC1;<br />

TASC1 &= ~CHF;<br />

TempHalls = HallSensorInputs();<br />

/* <strong>Co</strong>mpute actual rotor direction from hall effect sensor changes */<br />

if ( (TempHalls == (HALL_C)) || (TempHalls == (HALL_A | HALL_B)) )<br />

Actual_Direction = CW;<br />

else<br />

Actual_Direction = CCW;<br />

Time_Out = 0;<br />

NextSequence();<br />

}<br />

return;<br />

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

DRM007<br />

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

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

Saved successfully!

Ooh no, something went wrong!