Hello,
This post comes in continuation to a question I already asked on the forum.
I'm designing a PID control system that does the following:
1. Takes linear and angular acceleration readings from a sensor via I2C.
2. Calculates the angle ( roll ) of the object I want to control.
3. Calculates the required Proportional , Integral and Derivative control values.
4. Sends the control command 400 times per second ( 400 MHz ) via PWM.
Because step 4 is slowest event in the system - I want to time everything to it.
The PWM is generated from one the TIVA's peripheral modules - which is also capable of generating an interrupt synchronous to the PWM frequency.
So my idea is to have steps 1 to 4 execute inside the PWM Interrupt Service Routine.
What do you think about this approach ?
Is it good ? Or perhaps there's a better / simpler way ?