Difference between revisions of "Controlling a DC Motor with an Encoder"

From Mech
Jump to navigationJump to search
m
 
m
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


[[image:xPC PID example.jpg|center]]
[[image:xPC PID example.jpg|center]]

Here is the code: [[media:xPC PID Example.mdl|xPC PID Example.mdl]]
When using this model, you should set the sample time and discrete filter properties by opening File -> Model Properties -> Callbacks -> InitFcn.

[[image:PID example model properties.jpg|center]]

Latest revision as of 13:00, 7 August 2006

Controlling a brushed DC motor with an encoder is very common and serves as a good example of the basic programming of xPC models. Below you will find the xPC model code for controlling a DC motor, like the Maxon 6W motor in the lab.

XPC PID example.jpg

Here is the code: xPC PID Example.mdl

When using this model, you should set the sample time and discrete filter properties by opening File -> Model Properties -> Callbacks -> InitFcn.

PID example model properties.jpg