hi I’m using PLECS with TI C2000 Code Generation target support package. Is there a way to force the reset counter of the encoder with a software input?
In the quadrature counter encoder tab there is the possibility to choose the counter reset method. We can choose between free running and index impulse. Then there is the possibility to choose . What does means?
There is not a software input to reset the counter. You could construct some logic to reset the count in your model subject to some external condition, for example by latching the count when the condition is met and subtracting the latched count from the current count. The tricky bit will be handling the various types of rollover that can happen and in both directions.
The is not a particular mode, but rather allows you to use a variable to select the available modes. The convention is common any component in PLECS which uses the “Combo Box” type of parameter entry.
For example, in the Model Initialization Commands (accessible from the Initialization tab in the Simulation + Simulation parameters… drop-down) one could define a variable titled “reset_mode = 1” and then enter “reset_mode” into the reference field. A value of 1 corresponds to the second menu option (Free running), a value of 2 corresponds to the second item (Index pulse), and so on. Then you can change this in the initialization script.