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 />
Source <strong>Co</strong>de Files<br />
void InitTimerB (void)<br />
{<br />
/*<br />
Used for:<br />
1 Speed Calculation<br />
2 <strong>Co</strong>mmutation<br />
*/<br />
TBSC;<br />
TBSC = TSTOP | TRST | Prescaler_by_64;<br />
TBMOD = 0xFFFF;<br />
TBSC0 = CHIE | IC_any_Edge; // HALL B<br />
TBSC1 = CHIE | IC_any_Edge; // HALL C<br />
}<br />
return;<br />
/*****************************************************************************\<br />
* interrupt void TIMA_OV_ISR (void): Interrupt handler subroutine for motor *<br />
* control, motor stalled protection and application *<br />
* management. This interrupt occurs every millisecond. *<br />
* *<br />
* Parameters: None. *<br />
* *<br />
* Return: None. *<br />
\*****************************************************************************/<br />
interrupt void TimerAOverflow_ISR (void) // 519 max, 403 typ<br />
{<br />
extern UBYTE BLDCState;<br />
TASC;<br />
TASC &= ~TOF;<br />
Dif_Capture = Actual_Capture - Past_Capture;<br />
if (Dif_Capture > MAXPERIOD)<br />
Speed = MINSPEED;<br />
else if (Dif_Capture < MINPERIOD)<br />
Speed = MAXSPEED;<br />
else<br />
{<br />
/*<br />
1665<br />
Speed = ------------------<br />
(Dif_Capture / 18)<br />
*/<br />
asm{<br />
TXA<br />
BLDC Motor <strong>Co</strong>ntrol Board for Industrial and Appliance Applications<br />
DRM007<br />
MOTOROLA Source <strong>Co</strong>de 131