Commands and attributes, VFCADC

The following script shows how a VFCADC is operated. A DAC generates some voltage which is fed into the VFCADC. The VFC is gated by the timer t1. Note that gain, offset and polarity have to be set only once.

#!/usr/bin/python 

from PyTango import *
import sys
import time

try :
    dac1 = DeviceProxy( "someHost:10000/hires/exp/dac1")
    vfc1 = DeviceProxy( "someHost:10000/hires/exp/vfc1")
    t1   = DeviceProxy( "someHost:10000/hires/exp/t1")
    #
    # set the DAC output
    #
    dac1.voltage = 3.5
    #
    # Prepare the VFC. Gain, offset and polarity are memorized attributes. 
    # After they have been set once the are automatically written to the 
    # device when the server is initialized.
    # 
    vfc1.Gain = 1
    vfc1.SetGain()
    vfc1.Offset = 0
    vfc1.SetOffset()
    vfc1.Polarity = 1
    vfc1.SetPolarity()
    #
    # reset the VFC
    #
    vfc1.Reset()
    #
    # start the timer
    #
    t1.SampleTime = 0.5
    t1.Start()
    while( t1.Check()):
        print( " Timer: ", t1.Read())
        time.sleep(0.1)
    #
    # read the VFC, notice that 'Value' is normalized
    # to the sample time whereas 'Counts' not.
    #
    print( " VFC, value  ", vfc1.Value)
    print( " VFC, counts ", vfc1.Counts)

except :
    print( "Failed with exception !")
    print( sys.exc_info()[0]    )