esrf

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

PEPU.MAC
See other macros in category: All
Description:
    Macros to control ESRF PePU device over ethernet
Documentation:
    DESCRIPTION
    Configuring counters
    Implements macro counters to read encoder outputs and inputs. Implements also the control of embedded acquisition, so called streams. Configure first a macro motor controller with DEVICE field set to string "pepu" and ADDR field set to the hostname of PePU device. Therefore there must be ONE macro motor controller per PePU. The "NUM" field must be set to 9
    Then configure a counter using the previous controller, the "channel" is used to select the output channel (from 1 to 8)
    An optional parameter "type" can be set to select what to read on the given channel ("IN", "OUT", "AUX"). By default, the input will be read
    Configuring motors
    Macro motors can be configured to control the encoder outputs. Configure first a macro motor controller with DEVICE field set to string "pepu" and ADDR field set to the hostname of PePU device. Therefore there must be ONE macro motor controller per PePU. The "NUM" fielt must be set to 9
    Then configure a motor using the previous controller, the "channel" is used to select the output channel (from 5 to 8)
    An optional parameter "type" can be set to select what to read on the given channel ("IN", "OUT", "AUX"). By default, the output will be read


Macros:
    pepu
    Usage: pepu hostname
    Launch an interactive command line interface. This allows for intance to check/setup the instrument configuration using direct command like ?HELHP

    pepu_setup
    Usage: pepu_setup logical_name host_name
    Create a new logical name to acces the PePU instrument given by its name on the network.

    pepu_stream_add
    Usage: pepu_stream_add logical_name stream_name
    Create a new stream, identified by its name, on a PePU instrument.

    pepu_stream_del
    Usage: pepu_stream_del stream_name
    Remove any previous configuration for the given stream. The corresponding instrument will also be updated.

    pepu_stream_trig
    Usage: pepu_stream_trig stream_name start clock
    Configure the signal used to start the acquistion and the signal used as acquistion clock. The signals could be "SOFT" "DI1" "DI2" "FREQ"

    pepu_stream_fsample
    Usage: pepu_stream_fsample stream_name hz
    Configure the acquisition clock, given in Hz. Useless if clock will be an external signal.

    pepu_stream_nsample
    Usage: pepu_stream_nsample stream_name nsamples
    Configure the number of samples

    pepu_stream_source_add
    Usage: pepu_stream_source_add stream_name channels
    The given channel will be acquired.

    pepu_stream_start
    Usage: pepu_stream_start stream_name
    Switch on the given stream and launch the acquistion. Handle also the software start if configured.

    pepu_stream_stop
    Usage: pepu_stream_stop stream_name
    Switch off the given stream and stop the acquistion.

    pepu_stream
    Usage: pepu_stream stream_name
    Print out current stream configuration

    dancedebug
    Usage: dancedebug


Internal Macros:
    pepu_config
    Usage: pepu_config ()
    Called by spec after reading the config file

    pepu_cmd
    Usage: pepu_cmd ()
    Called by spec on motor or counter operations

    pepu_comm
    Usage: pepu_comm (hostname, command)
    Send a command to the given PePU device and returns the answer if any TODO: port to deepdevice.mac

    pepu_wr
    Usage: pepu_wr (device, command)
    Send a command to the given PePU device TODO: port to deepdevice.mac

    pepu_rd
    Usage: pepu_rd (device)
    Waits for an answer from the given PePU device and returns it TODO: port to deepdevice.mac

    _pepu_lastchar
    Usage: _pepu_lastchar(ans)
    Return the last significant character (non terminator)

    _pepu_err
    Usage: _pepu_err
    Pure cosmetic macro

    _pepu_sfixed_40_8_to_double
    Usage: _pepu_sfixed_40_8_to_double (src_arrname, dst_arrname)
    Convert the given byte array to double array assuming PePU SFIXED data (40bits mantise + 8bits frac) is encoded over 64bits. The destination array is created with the given name. Retunrs the number of doubles converted or -1 in case of error.

    _pepu_setup
    Usage: _pepu_setup (logical_name, hostname)
    If the logical name already exists, it will be overwritten. Returns non null in case of error.

    _pepu_stream_add
    Usage: _pepu_stream_add (logical_name, stream_name)


    _pepu_stream_del
    Usage: _pepu_stream_del (stream_name)
    No error returned.

    _pepu_stream_trig
    Usage: _pepu_stream_trig (stream_name, start, clock)


    _pepu_stream_fsample
    Usage: _pepu_stream_fsample (stream_name, hz)


    _pepu_stream_nsample
    Usage: _pepu_stream_nsample (stream_name, nsample)


    _pepu_stream_nsample_limit
    Usage: _pepu_stream_nsample_limit (stream_name, nsample_limit)


    _pepu_stream_source_add
    Usage: _pepu_stream_source_add (stream_name, channel)
    Allowed channels "IN1/6" "CALC1/8"

    _pepu_stream_nsources
    Usage: _pepu_stream_nsources (stream_name)
    Returns the current number of sources

    _pepu_stream_arrname
    Usage: _pepu_stream_arrname (stream_name)
    Returns the current data array name

    _pepu_stream_start
    Usage: _pepu_stream_start (stream_name)


    _pepu_stream_stop
    Usage: _pepu_stream_stop (stream_name)


    _pepu_stream_nsample_cur
    Usage: _pepu_stream_nsample_cur (stream_name)
    Returns the number of samples ready to be read

    _pepu_stream_read
    Usage: _pepu_stream_read (stream_name, nsamples, arrname)
    Read the given number of samples and stores them in a array. The array will be created and named as given. It will be of type double

    _pepu_stream_poll_read
    Usage: _pepu_stream_poll_read (stream_name)


    _dance_get_array
    Usage: _dance_get_array (hostname, query_cmd, array_name)
    Returns the number of data read or -1 in case of error.

    _dance_checksum
    Usage: _dance_checksum (array_name)
    Work around to SPEC array_op("sum") loosing LSB bits. Much more slower than SPEC built-in of course. NOT VALIDATED

    dance_debug
    Usage: dance_debug


    _dance_debug
    Usage: _dance_debug (msg)


    _dance_tocase
    Usage: _dance_tocase (string, case)
    Convert to lower (case==1) or to upper (case==0) case the string passed

    _dance_tolower
    Usage: _dance_tolower (string)
    Return the lower string of the string passed

    _dance_toupper
    Usage: _dance_toupper (string)
    Return the upper string of the string passed

    _dance_trim
    Usage: _dance_trim (string)


    pepu_test_array_plot
    Usage: pepu_test_array_plot (stream_name, column)
    For tests only, do not use

    pepu_icepap_test
    Usage: pepu_icepap_test hostname [[[[npts] freq] loops] start_trig] clock_trig]
    For tests only, do not use
    Expects pulses on IN6 at the same frequency that the sampling one. Can use an IcePAP axis controlled in speed, with motor_par(..., "jog_speed", hz), and its DB25 "Outpos" configured to "AXIS" as "source".
    freq given in Hz
    loops -1 means infinite loop
    start_trig is "SOFT"(default) "DI1" "DI2"
    clock_trig is "FREQ"(default) "DI1" "DI2"

    pepu_test_renishaw
    Usage: pepu_test_renishaw hostname


Filename: pepu.mac
Author: MP+FLM+RH BLISS (Original 9/2015).
$Revision: 1.3 $ / $Date: 2016/11/21 11:53:21 $
Last mod.: 08/01/2018 13:51 by perez