esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

ELMO.MAC
See other macros in category: Positioning
Description:
    Macros to control ELMO motor controller through macro motor. Tested only with model "Whistle 01.01.10.00 31Dec2014B00G" using ethernet connection (configured by USB only) driving a single rotation stage.
Documentation:
    DESCRIPTION
    Configuring macro motors
    1) You must have an entry in "MOTORS" table for each controller
    - The "DEVICE" field must be set to string "elmoeth"
    - The "ADDR" must be set to the IP adress + port like elmoid111:5001
    - The "NUM" should be set to
    - The "TYPE" field must be set to "Macro Motors"
    2) For each axis you must define a motor with:
    - The "Controller" field set to "MAC_MOT"
    - The "Unit" field, numbered from 0, must be set to the MOTORS entry.
    - The "Module" field is not used
    - The "Chan" field is not used
    In the additionnal parameter screen, the parameter "control_slave" can be set to 1 if the main motor has a slave driven by elmo controller
    Controller mode (user_mode motor_par)
    Position control mode
    On spec reconfig, the control position is automatically set. The ELMO corresponding user_mode is 4 for linear motors (aux. encoder feedback loop) or 5 for rotary motors (main encoder feedback loop) depending on "Linear/Rotary" field in spec config.
    Speed control mode
    Correspond to ELMO user_mode = 2. In this mode, higher velocity can be reached but no control position commands can be executed (ie. no standard mv/mvr/...).
    Motor parameters implemented
    power
    Switch motor on(1) / off(0). On power ON, the command position is updated. If the user_mode is in control position (4 or 5), on power ON, the command position is updated. If ran outside config (ie. on a motor_par), read_motors(0x6) is called to update spec internals.
    enc_position
    Return actual encoder position
    user_mode
    Change the ELMO control mode (4/5: position control, 2: speed control). When switching to position control mode, the command position is updated. The read_motors(0x6) is executed to update spec internals.
    jog_speed
    Start a jog speed motion in (deg or mm)/sec. Stop it if speed = 0.
    jog_range
    Read speed range for jog motion
    enable_slave
    Temporary disable/enable slave control
    Homing procedure implemented
    chg_dial(mot, "home+")
    Jog motor in user positive direction until home switch. Sets the controller position (dial) to the position eventually defined in spec config as "home position" (0 by default)
    chg_dial(mot, "home-")
    Same procedure moving in negative direction


Macros:
    elmoethdebug
    Usage: elmoethdebug
    Toggle on/off debug messages

    elmoethhome
    Usage: elmoethhome <motor> [<user_position>]
    Search home switch in positive direction. At home switch, controller sets the dial position to spec "home_position". If asked, change offset according to given <user_position>

    elmoethstatus
    Usage: elmoethstatus <motor>
    Report detailed status and input port states

Internal Macros:
    elmoethdebug_init
    Usage: elmoethdebug_init


    elmoeth_config
    Usage: elmoeth_config(num,type,p1,p2,p3)
    MACRO MOTOR: Called by spec after reading the config file

    elmoeth_par
    Usage: elmoeth_par(num,key,todo,p1)
    MACRO MOTOR: Called by spec after reading the config file, after calling _config() and only if parameters are set in the config file for a motor.

    elmoeth_cmd
    Usage: elmoeth_cmd(num,key,p1,p2)
    MACRO MOTOR: Called by spec on motor operation.

    _elmoeth_start_home
    Usage: _elmoeth_start_home(mnum, dir, setpos, dialpos)


    elmoeth_query
    Usage: elmoeth_query (serialline, command)
    Send the command to the ELMO controller and returns its string answer if any or empty string if none. If case of error, returns -1.

    elmoeth_parseanswer
    Usage: elmoeth_parseanswer (command, answer)
    Parse controller serial response. Check command echo, error character, and return answer or (-1) on error

    elmoeth_multiquery
    Usage: elmoeth_multiquery(sl, ncmd, cmds, vals)
    Send multiple commands to controller (ncmd commands defined in ass array cmds[]). Parse answer of each commands and return answer or (-1) on errors in ass array vals[] Global return is 0 if sucess, -1 if one of the commands fails.

    elmoeth_printerr
    Usage: elmoeth_printerr (err)
    Print a string message corresponding to the binary error code given. See "Command Reference Manual" page 69 Command EC for detailed list.

    elmoeth_round
    Usage: elmoeth_round (x)
    Return a well rounded integer as opposed to int() which always round down

Filename: elmoeth.mac
Author: MP BLISS (Original 8/2011).
$Revision: 1.2 $ / $Date: 2017/06/13 15:11:53 $
Last mod.: 13/06/2017 17:12 by papillon