esrf

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

cpseudo.mac
See other macros in category: Tools
Description:
    A macros set to help in defining pseudo counters
Documentation:
    DESCRIPTION
    You should consider using the spec feature for implementing macro counters For more info check the spec help pages on macro hardware or type help mac_hdw in spec.
    Pseudo counters are a common used feature to implement counters in spec which do not have actual hardware connected (like calculations) or which are not directly supported in spec.


    EXAMPLE
    cpseudodef cnttim1 none cnt_move piezo_getangles none none none none 3 0
    Define a pseudo motor piezo1. Each time the user tries to move the piezo piezo_move is called. If the user wants to know the position of the piezo piezo_getangles is called. No action is taken on set ^c. The user parameters were 3 0 and could represent the channel on the corresponding DAC card.


    ATTENTION
    • Hitting ^c (so ^c twice) while the cleanup macro is running will undefine the cleanup macro (This will not erase your macro, it will just not be executed). Next time a counter/timer is started it is redefined again.
    • There are side effects in defining a pseudo counter inside curly brackets - be careful.


    DEPENDENCIES
    The file cpseudo.mac has to be loaded. ! This is done in startup (This file needs stchanges.mac)

Macros:
    cpseudodef
    Usage: cpseudodef <counter_mne> <precount> <postcount> <getcounts> <cleanup> <config> <userdata1> <userdata2>
    This macro defines a new pseudo-counter. The counter has to be configured and the controller set to NONE. Whenever a count_em macro is used (all the time spec wants to start a counter/timer) <precount> is called before starting the timer and <postcount> after. These macros will get three parameters. The first parameter will be the counter number, the second the string userdata1 and the third the string userdata2. Normally the <precount> or <postcount> macro will start your timer. In <getcounts> you have to fill the S[] array with the counts read from the counter/timer. S[sec := 0] should be the time in seconds. The userdata can be used to give some information to the macro (for example the device server name). The <cleanup> macro will be called if the user hits ^c or some error condition occures (A limit is hit for example). The <config> macro will be called after the user called config. If you do not want to wait in your macros until counting has finished (and in this allow updated count commands), you can increment the USER_COUNTERSRUN global variable. While waiting your <pollcounts> macro will be called. Inside you can decrement USER_COUNTERSRUN as soon as you finished counting. Special care has to be taken if the user hits ^c.

    cpseudosdef
    Usage: cpseudosdef <var-name>
    same as cpseudodef , the input parameter is just a variable name

    cpseudodel
    Usage: cpseudodel [countermne]
    A pseudomotor/counter can be deleted with this macro

Internal Macros:
    _cpseudodef
    Usage: _cpseudodef


    pseudo_hook
    Usage: pseudo_hook


    cpseudosdel
    Usage: cpseudosdel


    cpseudoshow
    Usage: cpseudoshow


Filename: cpseudo.mac
Author: CPSEUDO.MAC JK 6.94
Last mod.: 27/02/2008 17:20 by rey