Functions | Variables

cmd_pxmc.c File Reference

#include <types.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <cmd_proc.h>
#include <cpu_def.h>
#include <pxmc.h>
#include <utils.h>
Include dependency graph for cmd_pxmc.c:

Functions

pxmc_state_t * cmd_opchar_getreg (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_opchar_getreg - selects the right axis
int cmd_do_reg_go (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_go - checks the command format validity and calls pxmc_go.
int cmd_do_pwm (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_pwm - checks the command format validity and calls pxmc_set_const_out.
int cmd_do_reg_hh (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_hh - checks the command format validity and calls pxmc_hh (home hardware).
int cmd_do_reg_spd (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_spd - checks the command format validity and calls pxmc_spd.
int cmd_do_reg_spdfg (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_spdfg - checks the command format validity and calls pxmc_spdfg.
int cmd_do_stop (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_stop - checks the command format validity and calls pxmc_stop.
int cmd_do_release (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_release - checks the command format validity and calls pxmc_set_const_out(mcs,0).
int cmd_do_clrerr (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_clrerr - checks the command format validity, clears the error flag.
int cmd_do_zero (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_zero - checks the command format validity, sets axis position to 0.
int cmd_do_align (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_align - checks the command format validity, sets offset between table and IRC counter to 0 .
int cmd_do_reg_rw_pos (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_rw_pos - read or write function, param is converted in 'long' and shifted
int cmd_do_reg_short_val (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_short_val - read or write function, param is converted in 'integer'
int cmd_do_reg_long_val (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_long_val - read or write function, param is converted in 'long'
int cmd_do_axis_mode (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_axis_mode - checks the command format and busy flag validity, calls pxmc_axis_mode
int cmd_do_regptmod_short_val (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
int cmd_do_reg_type (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_reg_type - no code written, will set controller structure
int cmd_do_reg_dbgset (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 cmd_do_regsfrq - sets or returns smapling frequency
int cmd_do_reg_dbgpre (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
int cmd_do_reg_dbghis (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
int cmd_do_reg_dbggnr (cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])

Variables

cmd_des_t const cmd_des_go
cmd_des_t const cmd_des_pwm
cmd_des_t const cmd_des_hh = {0, CDESM_OPCHR,"HH?","hard home request for axis",cmd_do_reg_hh,{}}
cmd_des_t const cmd_des_spd = {0, CDESM_OPCHR,"SPD?","speed request for axis",cmd_do_reg_spd,{}}
cmd_des_t const cmd_des_spdfg
cmd_des_t const cmd_des_stop
cmd_des_t const cmd_des_release
cmd_des_t const cmd_des_zero
cmd_des_t const cmd_des_align
cmd_des_t const cmd_des_clrerr
cmd_des_t const cmd_des_ap
cmd_des_t const cmd_des_st
cmd_des_t const cmd_des_axerr
cmd_des_t const cmd_des_regp
cmd_des_t const cmd_des_regi
cmd_des_t const cmd_des_regd
cmd_des_t const cmd_des_regs1
cmd_des_t const cmd_des_regs2
cmd_des_t const cmd_des_regmd
cmd_des_t const cmd_des_regms
cmd_des_t const cmd_des_regacc
cmd_des_t const cmd_des_regme
cmd_des_t const cmd_des_regcfg
cmd_des_t const cmd_des_ptirc
cmd_des_t const cmd_des_ptper
cmd_des_t const cmd_des_ptshift
cmd_des_t const cmd_des_ptvang
cmd_des_t const cmd_des_pwm1cor
cmd_des_t const cmd_des_pwm2cor
cmd_des_t const cmd_des_axis_mode
cmd_des_t const cmd_des_reg_type
cmd_des_t const cmd_des_reg_dbgset
cmd_des_t const cmd_des_reg_dbgpre
cmd_des_t const cmd_des_reg_dbghis
cmd_des_t const cmd_des_reg_dbggnr
cmd_des_t const * cmd_pxmc_default []

Function Documentation

int cmd_do_align ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_align - checks the command format validity, sets offset between table and IRC counter to 0 .

it also stop the rotation calling pxmc_set_const_out(mcs,0) and sets axis position to 0.

Here is the call graph for this function:

int cmd_do_axis_mode ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_axis_mode - checks the command format and busy flag validity, calls pxmc_axis_mode

if pxmc_axis_mode returns -1, cmd_do_axis_mode returns -1.

Here is the call graph for this function:

int cmd_do_clrerr ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_clrerr - checks the command format validity, clears the error flag.

it also stop the rotation calling pxmc_set_const_out(mcs,0)

Here is the call graph for this function:

int cmd_do_pwm ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_pwm - checks the command format validity and calls pxmc_set_const_out.

Here is the call graph for this function:

int cmd_do_reg_dbggnr ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)
int cmd_do_reg_dbghis ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

Here is the call graph for this function:

int cmd_do_reg_dbgpre ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

Here is the call graph for this function:

int cmd_do_reg_dbgset ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_regsfrq - sets or returns smapling frequency

Here is the call graph for this function:

int cmd_do_reg_go ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_go - checks the command format validity and calls pxmc_go.

if pxmc_go returns -1, cmd_do_reg_go returns -1.

Here is the call graph for this function:

int cmd_do_reg_hh ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_hh - checks the command format validity and calls pxmc_hh (home hardware).

if pxmc_hh returns -1, cmd_do_reg_hh returns -1.

Here is the call graph for this function:

int cmd_do_reg_long_val ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_long_val - read or write function, param is converted in 'long'

if the command typed is a write function, records the value, if it is a read function returns the value asked.

Here is the call graph for this function:

int cmd_do_reg_rw_pos ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_rw_pos - read or write function, param is converted in 'long' and shifted

if the command typed is a write function, records the value, if it is a read function returns the value asked.

Here is the call graph for this function:

int cmd_do_reg_short_val ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_short_val - read or write function, param is converted in 'integer'

if the command typed is a write function, records the value, if it is a read function returns the value asked.

Here is the call graph for this function:

int cmd_do_reg_spd ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_spd - checks the command format validity and calls pxmc_spd.

if pxmc_spd returns -1, cmd_do_reg_spd returns -1.

Here is the call graph for this function:

int cmd_do_reg_spdfg ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_spdfg - checks the command format validity and calls pxmc_spdfg.

if pxmc_spdfg returns -1, cmd_do_reg_spdfg returns -1.

Here is the call graph for this function:

int cmd_do_reg_type ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_reg_type - no code written, will set controller structure

int cmd_do_regptmod_short_val ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

Here is the call graph for this function:

int cmd_do_release ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_release - checks the command format validity and calls pxmc_set_const_out(mcs,0).

Here is the call graph for this function:

int cmd_do_stop ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_stop - checks the command format validity and calls pxmc_stop.

Here is the call graph for this function:

int cmd_do_zero ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_do_zero - checks the command format validity, sets axis position to 0.

it also stop the rotation calling pxmc_set_const_out(mcs,0)

Here is the call graph for this function:

pxmc_state_t* cmd_opchar_getreg ( cmd_io_t *  cmd_io,
const struct cmd_des *  des,
char *  param[] 
)

cmd_opchar_getreg - selects the right axis

pxmc is designed for multi axis motion control, so each axis must be identificated. This done by a capital letter. The first axis must be A, the 2nd B, etc.

Here is the caller graph for this function:


Variable Documentation

cmd_des_t const cmd_des_align
Initial value:
{0, CDESM_OPCHR,
                        "ALIGN?","align commutator",cmd_do_align,{}}
cmd_des_t const cmd_des_ap
Initial value:
{0, CDESM_OPCHR|CDESM_RD,
                        "AP?","actual position",cmd_do_reg_rw_pos,
                        {(char*)pxmc_state_offs(pxms_ap),
                         0}}
cmd_des_t const cmd_des_axerr
Initial value:
{0, CDESM_OPCHR|CDESM_RD,
                        "AXERR?","last axis error code",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_errno),
                         0}}
cmd_des_t const cmd_des_axis_mode
Initial value:
{0, CDESM_OPCHR|CDESM_WR,
                        "REGMODE?","axis working mode",cmd_do_axis_mode,
                        {}}
cmd_des_t const cmd_des_clrerr
Initial value:
{0, CDESM_OPCHR,
    "PURGE?"," clear 'axis in error state' flag",cmd_do_clrerr,{}}
cmd_des_t const cmd_des_go
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "G?","go to target position",cmd_do_reg_go,{}}
cmd_des_t const cmd_des_hh = {0, CDESM_OPCHR,"HH?","hard home request for axis",cmd_do_reg_hh,{}}
cmd_des_t const cmd_des_ptirc
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGPTIRC?","number of irc pulses per phase table",cmd_do_regptmod_short_val,
                        {(char*)pxmc_state_offs(pxms_ptirc),
                         (char*)4,(char*)10000}}
cmd_des_t const cmd_des_ptper
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGPTPER?","number of elmag. revolutions per phase table",cmd_do_regptmod_short_val,
                        {(char*)pxmc_state_offs(pxms_ptper),
                         (char*)1,(char*)100}}
cmd_des_t const cmd_des_ptshift
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGPTSHIFT?","shift (in irc) of generated phase curves",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_ptshift),
                         0}}
cmd_des_t const cmd_des_ptvang
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGPTVANG?","angle (in irc) between rotor and stator mag. fld.",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_ptvang),
                         0}}
cmd_des_t const cmd_des_pwm
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "PWM?","direct axis PWM output",cmd_do_pwm,{}}
cmd_des_t const cmd_des_pwm1cor
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGPWM1COR?","PWM1 correction",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_pwm1cor),
                         0}}
cmd_des_t const cmd_des_pwm2cor
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGPWM2COR?","PWM2 correction",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_pwm2cor),
                         0}}
cmd_des_t const cmd_des_reg_dbggnr
Initial value:
{0, CDESM_OPCHR|CDESM_WR,
                        "REGDBGGNR","controller response to HIST course",cmd_do_reg_dbggnr,{}}
cmd_des_t const cmd_des_reg_dbghis
Initial value:
{0, CDESM_OPCHR|CDESM_WR,
                        "REGDBGHIS","read history course",cmd_do_reg_dbghis,{}}
cmd_des_t const cmd_des_reg_dbgpre
Initial value:
{0, CDESM_OPCHR|CDESM_WR,
                        "REGDBGPRE","store reference course",cmd_do_reg_dbgpre,{}}
cmd_des_t const cmd_des_reg_dbgset
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGDBG?","sets debug flag",cmd_do_reg_dbgset,{}}
cmd_des_t const cmd_des_reg_type
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGTYPE?","unused",cmd_do_reg_type,{}}
cmd_des_t const cmd_des_regacc
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGACC?","maximal acceleration",cmd_do_reg_long_val,
                        {(char*)pxmc_state_offs(pxms_ma),
                         0}}
cmd_des_t const cmd_des_regcfg
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGCFG?","hard home and profile configuration",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_cfg),
                         0}}
cmd_des_t const cmd_des_regd
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGD?","controller derivative gain",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_d),
                         0}}
cmd_des_t const cmd_des_regi
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGI?","controller integral gain",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_i),
                         0}}
cmd_des_t const cmd_des_regmd
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGMD?","maximal allowed position error",cmd_do_reg_rw_pos,
                        {(char*)pxmc_state_offs(pxms_md),
                         0}}
cmd_des_t const cmd_des_regme
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGME?","maximal PWM energy or voltage for axis",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_me),
                         0}}
cmd_des_t const cmd_des_regms
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGMS?","maximal speed",cmd_do_reg_long_val,
                        {(char*)pxmc_state_offs(pxms_ms),
                         0}}
cmd_des_t const cmd_des_regp
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGP?","controller proportional gain",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_p),
                         0}}
cmd_des_t const cmd_des_regs1
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGS1?","controller S1",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_s1),
                         0}}
cmd_des_t const cmd_des_regs2
Initial value:
{0, CDESM_OPCHR|CDESM_RW,
                        "REGS2?","controller S2",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_s2),
                         0}}
cmd_des_t const cmd_des_release
Initial value:
{0, CDESM_OPCHR,
                        "RELEASE?","releases axis closed loop control",cmd_do_release,{}}
cmd_des_t const cmd_des_spd = {0, CDESM_OPCHR,"SPD?","speed request for axis",cmd_do_reg_spd,{}}
cmd_des_t const cmd_des_spdfg
Initial value:
{0, CDESM_OPCHR,"SPDFG?",
                        "fine grained speed request for axis",cmd_do_reg_spdfg,{}}
cmd_des_t const cmd_des_st
Initial value:
{0, CDESM_OPCHR|CDESM_RD,
                        "ST?","axis status bits encoded in number",cmd_do_reg_short_val,
                        {(char*)pxmc_state_offs(pxms_flg),
                         0}}
cmd_des_t const cmd_des_stop
Initial value:
{0, CDESM_OPCHR,
                        "STOP?","stop motion of requested axis",cmd_do_stop,{}}
cmd_des_t const cmd_des_zero
Initial value:
{0, CDESM_OPCHR,
                        "ZERO?","zero actual position",cmd_do_zero,{}}
cmd_des_t const* cmd_pxmc_default[]