esrf

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

can9660.mac
See other macros in category: Detection MCA
Description:
    Simple macros to control the "digital" DSP Canberra 9660.
Documentation:
    DESCRIPTION
    Simple macros to control the "digital" DSP Canberra 9660.

    All addresses and ID are explained in the document Software Design Document for 2060/9660 Module by Canberra Industries, Inc. registers really used are:
     1 6 7 8 e f 10 11 12 13 14 15 16 17 18 19 1a
     1b 1c 1d 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2f 30 31 32 33 34 35
     36 37 38 39 3a 3b 3c 3d 3e 3f 46 54 55 56 57 58 
    
    so unused ones are:
     2 3 4 5 9 a b c d e f 2e 40 41 42 43 44 45 47 to 53
    


    The macro name prefix AS refers to Andrea DAROCZYNE SOMOGYI

    Modifications history:
    Jan 2002
    HW Creation
    Feb 2002
    HW better input, saver calculations and more possibilities
    Feb 2002
    HW more options
    2002/02/19
    HW add save and restore configuration using files. use can9660save_config and can9660restore_config.
    2003/07
    HW add Stabilizer setup.
    2003/11
    HW change CAN9660 array structure, make the save and restore stuff work. Bugfix of the AS_CAN9660_calc_gain() macro. Values are now user friendly, they are not entered as integer, but in whatever their unit is.


Macros:
    can9660menu
    Usage: can9660menu
    menu macro to set some parameters in Canberra 9660 DSP

    can9660setup
    Usage: can9660setup <mca device name> <icb address>
    Sets up a canberra 9660 DSP on ICB address <icb address>. The MCA device name is taken as unit 0 from SPEC.

    can9660save_config
    Usage: can9660save_config [filename] [overwrite]
    Save the DSP parameters to an ASCII file, so they can be reloaded later by the "can9660restore_config" macro. The file is in the directory ~blissadm/local/spec/userconf/dsp and has the name, that you choose.
    If no name is specified as first argument, the user is prompted for one. If the file exists, the user will be prompted to confirm overwriting, unless a second argument is present.

    can9660restore_config
    Usage: can9660restore_config [filename]
    Restore the parameters stored in the file given by the only argument or entered by the user on request.
    The values will not immediately written to the controller, but will replace the values shown in the menus at the next call of can9660menu. If you choose not to write the values to the controller, they will persist, until you either write them to the controller or perform a new can9660setup. This will not destroy the existing data, but force the reading of the controller, which will provide you again with the life values.

Internal Macros:
    AS_CAN9660_menu_helper
    Usage: AS_CAN9660_menu_helper()
    no description, needed as exitmacro value to the menu() function

    AS_CAN9660_display
    Usage: AS_CAN9660_display ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_gain_helper1
    Usage: AS_CAN9660_gain_helper1()
    no description

    AS_CAN9660_gain_helper2
    Usage: AS_CAN9660_gain_helper2()
    no description

    AS_CAN9660_gain_display
    Usage: AS_CAN9660_gain_display ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_fdisc_display
    Usage: AS_CAN9660_fdisc_display ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_ADC_display
    Usage: AS_CAN9660_ADC_display ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_filter_display
    Usage: AS_CAN9660_filter_display ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_Stabilizer_display1
    Usage: AS_CAN9660_Stabilizer_display1 ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_Stabilizer_display2
    Usage: AS_CAN9660_Stabilizer_display2 ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_Stabilizer_reset
    Usage: AS_CAN9660_Stabilizer_reset ()
    menu driven macro function called by can9660menu. Don't use this macro directly.

    AS_CAN9660_find_gain
    Usage: AS_CAN9660_find_gain (gain)
    tries to find the closest settings for DSP to have the desired gain. This macro function returns a string with the three values cgain, fgain and sfgain. Please see description of macro AS_CAN9660_calc_gain() for detailed explaination on how to calculate the gain.

    AS_CAN9660_calc_gain
    Usage: AS_CAN9660_calc_gain (cgain, fgain, sfgain)
    calculates the real gain out of coarse, fine and super fine gain. This macro function returns the calculated gain.

    Formula: Gain = Coarse Gain * (Fine Gain + Super Fine Gain)
    Coarse Gain can be: 5, 15, 40, 120, 330, 960
    Fine gain is 0x100 to 0xfff representing *0.4 to *1.6
    Super fine gain is 0x000 to 0xfff representing 0 to 0.03

    AS_CAN9660_int_calc_gain
    Usage: AS_CAN9660_int_calc_gain(cgain, fgain, sfgain)


    AS_CAN9660_preset
    Usage: AS_CAN9660_preset ()
    Don't use this macro directly. Presets the data structure used by the macros for the canberra 9660 DSP

    AS_CAN9660_write_interesting
    Usage: AS_CAN9660_write_interesting ()
    Writes all the interesting values to the controller. Don't use this macro directly. Presets the data structure used by the macros for the canberra 9660 DSP

    AS_CAN9660_write_force
    Usage: AS_CAN9660_write_force ()
    Writes all the values to the controller. Presets the data structure used by the macros for the canberra 9660 DSP

    AS_CAN9660_verbose
    Usage: AS_CAN9660_verbose
    Only for test purposes. Sets the verbose option used by the macros for the canberra 9660 DSP

    AS_CAN9660_reset
    Usage: AS_CAN9660_reset
    Documented to send a reset

    AS_CAN9660_ready
    Usage: AS_CAN9660_ready
    Documented to send a device ready

    AS_CAN9660_init
    Usage: AS_CAN9660_init
    Send a device ready and restore the values initially set by Andrea S.

    AS_CAN9660_modulestatus
    Usage: AS_CAN9660_modulestatus
    read register 6 of the DSP module and decode the various bits.

    AS_CAN9660_readtableval
    Usage: AS_CAN9660_readtableval (data table index)
    read a value from the DSP data space. To read such a value, you must write registers 2 to 5 (5 always last ) with the appropriate contents, then check R6 for the RDAV bit and the re-read the R2-5 to find the result in the same registers. The RDAV bit is self clearing, one read will clear it.

    AS_CAN9660_writetableval
    Usage: AS_CAN9660_writetableval (data table index, value to write)
    write a value from the DSP data space. To write such a value, you must write registers 2 to 5 (5 always last ) with the appropriate contents, then check R6 for the WDONE bit. The RDAV bit is self clearing, one read will clear it.

Filename: can9660.mac
Author: Holger
Last mod.: 27/02/2008 15:19 by rey