Function: _MPWM1Interrupt ()
Overview: PWM reload interrupt used to filter the BEMF signals using the Majori ty detection filter to detect a valid
zero-crossing event. If a valid zero-crossing event w as detected then it calls the PreCommu tationState function. This
function also includes the start-up sequence for detecting the initial rotor position
Note: None
Function: _T1Interrupt ()
Overview: Here is w here the motor commutation occurs; Timer1 ISR is utilized as the commutation delay used to
commutate the motor w indings at the ri ght time. It also resets the Blanking Counter. This counter must be cleared
after a commutation occurs in order to the detection of false zero-crossing events.
Note: None
Function: PreCommutationState ()
Overview: This function measures the 60 and 30 electrical degrees using the T imer2. The 60 electrical degrees is
proportional to the elapsed time betw een zero-crossing events. The zero-crossing events occur 30 electrical degrees
in advance of the commutation point. Hence a delay proportional to the 30 electrical degrees is added using the
Timer1. This commutation delay can be modified in or der to phase advance the commutation. The phase advance
angle can be any value within 0 to 30 angles. This function also calls the open loop function or the close loop function
(depending on which mode is activated) when the zero-crossing event is detected.
Note: None
Function: SpeedPILoopController()
Overview: When the macro CLOSE_LOOP_MODE is defined, the motor operat es in close loop mode. T he Speed_P,
Speed_I and Speed_D parameters were determined using the HURST Motor, which is sold through Microchp Direct
at www.microchipdirect.com
(Part Number: AC300020). T hese values should be recalculated according to the motor
and load characteristics.
Note: None
Function: OpenLoopController()
Overview: When the the macro CLOSE_LOOP_MODE is not defined, the motor operates in open loop mode.
Note: None
Function: InitADC10()
Overview: Initializes the ADC module to operate in simultaneous mode, sampling terminals AN1, AN3, AN4, and AN5
using MUX A. T he ADC channels are assigned as follows in the dsPICDEM MCLV Deve lopment Board: CH0->AN1
(POT), CH1->AN3 PHASE A, CH2->AN4 PHASE B, CH3->AN5 PHASE C. ADC is synchronised with the PWM. ADC
conversion is triggered every time a PW M reload event occurs. T
ADC = 271.37 ns. The resulting ADC samples are
formatted as right-justified, unsigned 10-bits.
Note: None
评论0