Pythton Client

The following example shows how a VFCADC, a DAC and timer work together.

#!/usr/bin/env python3

from PyTango import *
import sys
import time

try :
    dac1 = DeviceProxy( "p09/dac/eh.01")
    vfc1 = DeviceProxy( "p09/vfc/eh.01")
    t1   = DeviceProxy( "p09/dgg2/eh.01")
    #
    # 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.0
    vfc1.SetGain()
    vfc1.Offset = 0.0
    vfc1.SetOffset()
    vfc1.Polarity = 1
    vfc1.SetPolarity()
    #
    # reset the VFC
    #
    vfc1.Reset()
    #
    # start the timer
    #
    t1.sampleTime = 3.0
    t1.Start()

    while( t1.Check()):
        print( " Timer: ", t1.Read())
        time.sleep(0.1)
        print( " VFC, value  ", vfc1.Value)
        print( " VFC, counts ", vfc1.Counts)
    #
    # 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])