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 2.02.07.00" through RS232 and 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 "elmo"
    - The "ADDR" must be set to the serial line already declared in the current session config (ex: "6"). The serial line settings are 19200 bauds with mode Raw
    - 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
    - The "Linear/Rotary" field set to 1 for rotary motors, 0 otherwise
    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
    closed_loop
    Switch on(1) / off(0) the closed loop
    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.
    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:
    elmodebug
    Usage: elmodebug
    Toggle on/off debug messages

    elmohome
    Usage: elmohome <motor> <user_position>
    Search home switch in positive direction, sets the position to 0 and then move motor to user_position

Internal Macros:
    elmodebug_init
    Usage: elmodebug_init


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

    elmo_par
    Usage: elmo_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.

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

    elmo_query
    Usage: elmo_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.

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

    elmo_multiquery
    Usage: elmo_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.

    elmo_printerr
    Usage: elmo_printerr (err)
    Print a string message corresponding to the binary error code given. See "Command Reference Manual" page 3-32 for detailed list.

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

Filename: elmo.mac
Author: MP BLISS (Original 8/2011).
$Revision: 1.13 $ / $Date: 2017/06/13 15:03:55 $
Last mod.: 13/06/2017 17:04 by papillon