esrf

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

pi_e517.mac $Revision: 1.6 $
See other macros in category: All
Description:
    Macros to control a piezo PI E517 controller connected via TCP/IP.
Documentation:
    DESCRIPTION
    This macro file allows to connect a piezo to a macro motor in SPEC.
    PI E-517 (TCP)
    For debug purpose mainly, it's also possible to configure a macro counter that will read the position of a piezo axis. Parameter of the macro counter: <motor> : motor mnemonic to reflect position.

    SETUP
    In order to configure a macro motor:
    1) You must have a "MOTORS" defined with:
    DEVICE set to "pi_e517"
    TYPE set to "Macro Motor"
    ADDR set to the TCP Address of the controller
    NUM must be set also
    2) Per piezo axis you must define a motor with:
    Controller set to "MAC_MOT"
    Unit field must be set to the "MOTOR" entry.
    Chan field must be set to the piezo axis of the controller (for instance "0" stands for axis "A", "1" for "B" etc)
    In order to configure a macro counter:
    1) You must have a "SCALERS" defined with:
    DEVICE set to "pi_e517_c"
    TYPE set to "Macro Counter"
    NUM must be set also
    2) Per piezo axis you must define a counter with:
    Device set to "MAC_CNT"
    Mnemonic what you want.
    parameters "motor" -> mnemonic of the motor to reflect position.
    Unit do not mind
    Chan do not mind


Macros:
    pi_e517debug
    Usage: pi_e517debug [<personal msg>]
    Switch on or off the print of debug messages

    pi_e517_put
    Usage: pi_e517_put (<tcp_dev>, <cmd>)
    Sends <cmd> to a tcp device. Adds "\n" at end of <cmd> Uses tcp/ip device : <tcp_dev>.

    pi_e517_get
    Usage: pi_e517_get (<tcp_dev>)
    Reads and returns the socket.

    pi_e517_infos
    Usage: pi_e517_infos <mot_num>
    Prints out infos read from controller of motor <mot_num>

    pi_e517_get_parameters
    Usage: pi_e517_get_parameters (<mot_num>)
    Returns the list of all available parameters.

    pi_e517_get_parameter
    Usage: pi_e517_get_parameter (<mot_num>, <parma>)
    Returns the value of parameter <param>

    pi_e517_help
    Usage: pi_e517_help ()


    pi_e517_get_model
    Usage: pi_e517_get_model (<tcp_dev>)
    Returns the *controller* model name (should be E-517)

Internal Macros:
    pi_e517_err
    Usage: pi_e517_err <msg>
    Prints error message <msg> in bold with a red header.

    pi_e517_send
    Usage: pi_e517_send (<mot_num>, <cmd>)
    Sends <cmd> to the controller corresponding to motor <mot_num> and returns the answer. -<mot_num> : motor number -<cmd> : string

    pi_e517_send_no_ans
    Usage: pi_e517_send_no_ans (<mot_num>, <cmd>)
    Sends <cmd> to the controller corresponding to motor <mot_num> without wating for an answer. -<mot_num> : motor number -<cmd> : string Returns 0 in case of success. Returns -1 in case of error.

    pi_e517_get_tcp_dev_by_mot
    Usage: pi_e517_get_tcp_dev_by_mot (<mot_num>)
    Returns the ip address/name of the controller corresponding to motor <mot_num> Returns -1 in case of error.

    pi_e517_get_chan_letter
    Usage: pi_e517_get_chan_letter (<mot_num>)
    Returns the channel letter of axis of motor <mot_num>. Returns -1 in case of failure.

    pi_e517_get_chan_nb
    Usage: pi_e517_get_chan_nb (<mot_num>)
    Returns the channel NUMBER of axis of motor <mot_num>. Returns -1 in case of failure.

    pi_e517_get_read_pos
    Usage: pi_e517_get_read_pos (<mot_num>)
    Read the position from the controller axis corresponding to motor <mot_num> using command "POS? <N>" Returns the position read. Returns "ERROR" in case of error.

    pi_e517_get_pos
    Usage: pi_e517_get_pos (<mot_num>)
    Read the target position from the controller axis corresponding to motor <mot_num> using command "MOV? <N>" Returns the target position read. Returns "ERROR" in case of error.

    pi_e517_set_pos
    Usage: pi_e517_set_pos (<mot_num>, <position>)
    Sends to controller of axis corresponding to <mot_num> a move to <position> command. Sends "MOV A/B/C <position>" cannot do MOV in open loop : must use voltage. Returns -1 in case of error.

    pi_e517_get_voltage
    Usage: pi_e517_get_voltage (<mot_num>)
    Read the voltage from the controller axis corresponding to motor <mot_num> using command "? <N>" Returns the voltage read. Returns "ERROR" in case of error.

    pi_e517_get_closed_loop_status
    Usage: pi_e517_get_closed_loop_status(mot_num)


    pi_e517_get_status
    Usage: pi_e517_get_status (<mot_num>)
    Returns the individual "on-target status" of axis corresponding to motor <mot_num> Uses "ONT?" command ONT? return 1 if device is on-target Usable only in closed-loop ie if SVO? returns 1. Returns 0 if not on target and closed-loop active. Returns 1 if on target or closed-loop is disabled.

    pi_e517_stop
    Usage: pi_e517_stop (mot_num)
    Sends to controller of motor <mot_num> a stop command. Sends "STP" is it better to use HLT ? HLT -> stop smoothly. STP / 24 -> stop asap. !!! on a HLT or STP, the PI controller updates the target !!! position using real position...

    pi_e517_get_tolerances
    Usage: pi_e517_get_tolerances


    pi_e517_set_offline
    Usage: pi_e517_set_offline(mot_mne)


    pi_e517_set_online
    Usage: pi_e517_set_online(mot_mne)


    pi_e517_check_ctrl
    Usage: pi_e517_check_ctrl(mot_num)
    Checks if controller is responding sending it "IDN?". Returns 1 if controller is responding. Returns 0 if controller is NOT responding. Returns -1 in case of error.

    pi_e517_getch
    Usage: pi_e517_getch(ch)
    Converts channel from digit to single char. 1 -> "A" 2 -> "B" 3 -> "C"

    pi_e517_config
    Usage: pi_e517_config(mot_num, type, p1, p2, p3)
    Called by spec after reading the config file

    pi_e517_par
    Usage: pi_e517_par(mot_num, key, todo, p1)
    Called by spec on motor operation. p1 = ?

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

    pi_e517_c_config
    Usage: pi_e517_c_config(count_num, type, p1, p2, p3)
    Called by spec after reading the config file

    pi_e517_c_cmd
    Usage: pi_e517_c_cmd(count_num,key,p1,p2)
    Called by spec on counter operation.

    pi_e517_v_config
    Usage: pi_e517_v_config(count_num, type, p1, p2, p3)
    Called by spec after reading the config file

    pi_e517_v_cmd
    Usage: pi_e517_v_cmd(count_num,key,p1,p2)
    Called by spec on counter operation.

Filename: pi_e517.mac
Author: MP CG BLISS 2012 2013
Last mod.: 24/10/2014 16:47 by guilloud