esrf

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

millitron196.mac
See other macros in category: Positioning
Description:
    Millitron read through Wago or ICV196
Documentation:
    DESCRIPTION
    The millitron sensor can be read by cabling 16 digital inputs on a corresponding I/O card. This macro set allows to read a millitron as a counter in spec by using either an ICV196 or a wago module.

    The millitron output is a DB25 connector where pins are defined as follow:
             pin 1 :
             pin 2 :
             pin 3   : overflow
             pin 4   : x1000
             pin 5   : ready for measurement = 1
             pin 6   : ready for measurement = 0
             pin 7   : digital point 0.01
             pin 8   : digital point 0.1
             pin 9   : 0v DC
             pin 10  : 0v DC
             pin 11  : 
             pin 12  : sign 0->+ 1->-
             pin 13  : x800
             pin 14  : x400
             pin 15  : x100
             pin 16  : x80
             pin 17  : x40
             pin 18  : x20
             pin 19  : x10
             pin 20  : x8
             pin 21  : x8
             pin 22  : x4
             pin 23  : x2
             pin 24  : x1
             pin 25  : 
    


    SETUP


    WAGO :

    The macro counter method is used.
    • The macro set wagocore has to be loaded in spec.
    • Use spec config editor to setup a macro counter controller with prefix millitron .
    • Set the ADDR field to the wago controller name. Ex.: wcid51d.
    • Set the NUM field to a value holding as many counters as you will defined
    • In the scaler configuration window add individiual counters on that controller (type MAC_CNT) and assign corresponding unit number. The channel number is arbitrary but it must be unique and be coherent with the NUM value of the controller
    • Still in that window, set the cursor on top of the line of your counter. Hit the key "p" to add an extra parameter to the counter. This parameter must have its name set to "key" and the value corresponds to the wago key associated with the 16 digital input values.
    • Finally you can add an optional parameter with name "average" and value set to "1". The reading will then be averaged during counting. The default is set to 0 (= no average).


    ICV196 :

    The old pseudo counter method is used:

    Three counters must be defined in spec to get the readings. Use the macro millitronsetup (see usage below) to configure the card and assign the counters When using an ICV196 this macro set supposes that the millitron is cabled using 1 connector (J1, J2 or J3) by device. Each connector is clabed as follows :
             bit 0  (mod 32) : x1
             bit 1  (mod 32) : x2
             bit 2  (mod 32) : x4
             bit 3  (mod 32) : x8
             bit 4  (mod 32) : x10
             bit 5  (mod 32) : x20
             bit 6  (mod 32) : x40
             bit 7  (mod 32) : x80
             bit 8  (mod 32) : x100
             bit 9  (mod 32) : x200
             bit 10 (mod 32) : x400
             bit 11 (mod 32) : x800
             bit 12 (mod 32) : x1000
             bit 13 (mod 32) : val x 0.1
             bit 14 (mod 32) : val x 0.01
             bit 15 (mod 32) : sign
             bit 16 (mod 32) : ready
             bit 17 (mod 32) : overflow
    
    In the case of ICV196: up to 3 millitron devices can be read. There is on cable per device connected to a Icv196 connector. We associate a pseudo counter per each Icv196 connector even if there no millitron device connected.

Macros:
    milwagoread
    Usage: milwagoread wagokey
    Reads a millitron on a wago system. Prints the value on the screen

    millidbg
    Usage: millidbg 0 | 1
    Activates / Inactivates debuggin (ICV196)

    millitronsetup
    Usage: millitronsetup icv196_device_name cntj1 cntj2 cntj3
    setup macro for ICV196

    millitronon
    Usage: millitronon
    Activates pseudo counters (for ICV196)

    millitronoff
    Usage: millitronoff
    Inactivates pseudo counters (for ICV196)

    millprint
    Usage: millprint Connector_number [0-2]
    (ICV196 only)

Internal Macros:
    millitron_config
    Usage: millitron_config(mne, type)
    Called by spec at config time.

    millitron_cmd
    Usage: millitron_cmd(mne, cmd, p1,p2)
    Called by spec to read values

    _milwagoread
    Usage: _milwagoread(key)
    Perform the actual reading on wago and convert values

    millitron_globals
    Usage: millitron_globals


    _millitronread
    Usage: _millitronread ()
    For ICV196 / Reads J1, J2 and J3 and set the corresponding counters (32 channels per connector) If en error occurs (not_ready or overflow) the corresponding counter is set to -88888 If the millittron is disabled (cmd millitronoff) the 3 counters are set to -99999 The command DevMultipleChannelRead returns 12 values of 8 bits (12*8=96 channels).

    _millitron_getval
    Usage: _millitron_getval (tabval,conn)
    Returns the decimal value of one millitron (one connector) (ICV196 only)

    _millitron_ready
    Usage: _millitron_ready (tabval,conn)


    _millitron_overflow
    Usage: _millitron_overflow (tabval,conn)


    _millitron_getbit
    Usage: _millitron_getbit (tabval,bit,conn)
    returns the value of one bit

Filename: millitron196.mac
Author: Original: G. Berruyer . Commented and generalized: G. Pepellin / V.Rey for the wago version
Last mod.: 21/08/2008 15:05 by rey