Hardware manual

39
The advantage of the above equation is that it gives possibility to operate with help of
fixed point arithmetic, which increases controller precision and speed of calculations.
Secondly, as was already mentioned and shown in above formula, some values are given
in so called IRC units. Small example, we have phase table with length of 2048 elements
what is equal to 360
o
. To get 90
o
we need to divide 2048 by 4, and as the result we will get
512. This is 90
o
in IRC units.
In the following table, there are shown and described all elements which can be found in
pxmc_state structure.
Name of pole
Short description
pxms_flg
It was already mentioned in the part concerned with flags. Its only one
function is to hold flags which have influence on control of the motor.
pxms_do_inp
This is a pointer to a function which should read actual position and
speed of the motor and then update pxms_ap and pxms_as.
pxms_do_con
This one keeps pointer to function which implements controller and
computes pxms_ene according to the actual and required position of
the motor.
pxms_do_out
This is also pointer to a function which puts proper output values to
the PWM with regards to pxms_ene.
pxms_do_deb
This is a pointer to a debugging function which should store some
values and other important things. It is very useful when we testing
and checking the code.
pxms_do_gen
Here is kept pointer to function which generates trajectory. This
trajectory describes how the motor should reach desired position with
given speed and acceleration. We have several different trajectory
generators, for example: trapezoid, constant speed and also different
versions of them: normal and fine-grained. More information will be
given when I'll describe pxmc_gen_spdtrp.c file.
pxms_do_ap2hw
This is a pointer to function which presets a new actual position into
HW.
pxms_ap
PXMC keeps here the actual position of the motor. The value which we
can read or set must to be shifted using PXMC_SUBDIV. This value
should be given in IRC units.
pxms_as
PXMC keeps here the actual speed of the motor. The value which we
can read or set must to be shifted using PXMC_SUBDIV. This value
should be given in IRC units.
pxms_rp
PXMC keeps here the required position of the motor. The value which
we can read or set must to be shifted using PXMC_SUBDIV. In general
this value is set by generator.
pxms_rpfg
This is a position extension for Fine Grained generator.
pxms_rs
PXMC keeps here the required speed of the motor. The value which
we can read or set must to be shifted using PXMC_SUBDIV. In general
this value is set by generator.
pxms_rsfg
This is a speed extension for Fine Grained generator.