moro
Member level 3
Hello, i have a system which controls a 3 phase BLDC motor. The speed of the motor is read trough 3 hall sensors.
For controling the sistem, i have two timers with their own ISR/Interrupt handlers.
Timer1 ISR - i manage the dutycycle and the comutation of the motor phases, this ISR runs at a constant rate ( 40khz)
Timer2 ISR - runs everytime a change in the hall sensors state occurs, the rate can vary due to motor speed, in this ISR the actual rpm speed is calculated.
The PID has a reference input in rpm , and takes the feedback from the TIMER2 isr rpm calculation, depending on the error the dutycycle is adjusted for the next switching cycle so it will mantain the speed
Where its best to place the PID? in the ISR which has a constant "ticking" rate? Or in the same ISR where the speed is measured?
For controling the sistem, i have two timers with their own ISR/Interrupt handlers.
Timer1 ISR - i manage the dutycycle and the comutation of the motor phases, this ISR runs at a constant rate ( 40khz)
Timer2 ISR - runs everytime a change in the hall sensors state occurs, the rate can vary due to motor speed, in this ISR the actual rpm speed is calculated.
The PID has a reference input in rpm , and takes the feedback from the TIMER2 isr rpm calculation, depending on the error the dutycycle is adjusted for the next switching cycle so it will mantain the speed
Where its best to place the PID? in the ISR which has a constant "ticking" rate? Or in the same ISR where the speed is measured?