esrf

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

ADC.MAC
See other macros in category: Generic I/O
Description:
    Macros to work with an ADAS ICV 150 ADC from SPEC
Documentation:
    DESCRIPTION
    This macro set provides an easier interface to work with the ADAS ADC card. You can configure the ADC as a counter or monitor and use the standard SPEC macros to work with this card.
    The new version of these macros will read the ADC during counting and calculate the average value during this time. You need to define a timer therefore (use the UNIX software timer if you don't have another one)

    EXAMPLE
    adcwatch
    (Read the ADC and plot the results on the screen)
    ct 3
    (Read the adc during three seconds and display the average voltage)
    dscan motor1 0 10 10 2
    (Do a scan with motor1, but use the ADC to get at each point a reading in mV)
    adcsetup "ID9/icvadcID92/0" 2 1 0 50
    (This is normally done in idxxstartup.mac to set the parameters for the adc)


    SETUP
    • You have to define counters with mnemonics adc1, adc2, and so on with spec's configuration editor to use the adc. If adcsetup has been done , the counter adc<x> will hold the adc readings. If you undefine the counter adc<x> again, it will automatically realize that you do not want to read the adc for the moment.
    • The parameters for the adc and the definition of the pseudo counters are done with adcsetup.


    ATTENTION
    • The macros are written for the new version of the adc device server. There are still some beam lines where this version is not installed yet. You will get some error messages in the init phase, but should otherwise have no problems
    • Due to the way the adc is read during counting, you not only need a timer configured, but you might have problems with pseudo counters which block spec during counting (like the canberrra).
    • The gain can just be changed when the adc is stopped. You will get an error message from the server otherwise.
    • The result from adcmread is in mV, the result from adcread in Volt.
    • The ADC is setup to read at the moment you asked it for ( Triggered reading) not continiously


    DEPENDENCIES
    • The file adc.mac has to be read in !done by: startup script (this file needs: stchanges.mac cpseudo.mac)
    • Some of the parameters for the adc have to be set !done by: startup script with adcsetup


Macros:
    adcwatch
    Usage: adcwatch [s]: Like adcmread but the results will be plotted


    adcread
    Usage: adcread [Channel]
    reads from Channel or DEFAULT channel given in adcsetup

    adcscale
    Usage: adcscale [scale]
    Defines a global scale factor, every adc has to be multiplied with Default is 1000 to give mV output

    adcsetup
    Usage: adcsetup [mne device channel] [mne device channel] ...
    The new version allows multiple devices to be used. The input format had to be changed therefore, but the macros still accept the old input format:
    [device name] [channel] [No. of channels] [gain] [No. reads]
             Parameters: device name : the name of your device (ex.: ID112Adc)
    		      channel : the channel to read from (0-n)
                         No. of channels : number of channels to be read from
    		            the ADC card.
                         gain : the gain is given in power of 2. If the
                                range of your card is -10 to 10 V then:
    				gain 0 : -10 -> 10 V
    				gain 1 : -5 -> 5 V
    				gain 2 : -2.5 -> 2.5 V
    				gain 3 : -1.25 -> 1.25 V
    				gain 4 : -0.63 -> 0.63 V
                                Whatever gain you will set, the value you
                                read are always in Volt
                         No. reads : the number of reads for the multiple
                                     read command 
    
    The questions asked if you do not supply input parameters on the command line :
     How many ADC pseudo counters do you want to define
       Counter mnemonic (the counter mnemonic)
       Device name for pseudo counter (the ESRF device server)
       Channel on this ADC card (channel starts with 0) 
    


    adcoff
    Usage: adcoff
    Switches off all adc related in/output

    adcon
    Usage: adcon
    Switches on all adc related in/output (after adcoff)

    adcstart
    Usage: adcstart : starts the Adc for cont. reading


    adcstop
    Usage: adcstop : stops the Adc


Internal Macros:
    adc_allprecount
    Usage: adc_allprecount


    adc_precount
    Usage: adc_precount


    adc_allgetcounts
    Usage: adc_allgetcounts


    adc_getcounts
    Usage: adc_getcounts


    adc_mreadstart
    Usage: adc_mreadstart


    adc_mread
    Usage: adc_mread


    adc_init
    Usage: adc_init
    Sends the global values for adc min and max to the device.

    adcsetlast
    Usage: adcsetlast


    adcgain
    Usage: adcgain


    adcminmax
    Usage: adcminmax


Filename: adc.mac
Author: ADC.MAC Jorg Klora 15.2.93
Last mod.: 25/06/2007 17:14 by rey