delaere / VeheMencE

User friendly vme control library.
Other
1 stars 2 forks source link

Need more examples #14

Open delaere opened 4 years ago

delaere commented 4 years ago

More examples should be added, especially in python.

delaere commented 4 years ago
from VeheMencE import *
import time

# for this test, some input is connected to src0 and the output2 is connected to src1.
# we use the pulser B as a 0.1s gate for the scaler

vme = VmeUsbBridge()

# configure the scaler
scaler = vme.getScaler()
scaler.limit = 1000
scaler.autoReset = False
scaler.hitSource = CVIOSources.cvInputSrc0
scaler.gateSource = CVIOSources.cvInputSrc1
scaler.resetSource = CVIOSources.cvManualSW
scaler.configure()

# configure the pulser
pulserB = vme.getPulser(CVPulserSelect.cvPulserB)
pulserB.period = 2
pulserB.width = 1
pulserB.units = CVTimeUnits.cvUnit104ms
pulserB.pulseNo = 1
pulserB.startSource = CVIOSources.cvManualSW
pulserB.stopSource = CVIOSources.cvManualSW
pulserB.configure()

# configure the output line
vme.configureOutputLine(CVOutputSelect.cvOutput2,CVIOPolarity.cvDirect,CVLEDPolarity.cvActiveHigh,CVIOSources.cvMiscSignals)

# make a measurement: start the pulser, wait 1s, and read&reset the scaler.
pulserB.start()
time.sleep(1)
print scaler.count()/1.04
scaler.resetCount()
delaere commented 4 years ago
from VeheMencE import *
vme = VmeUsbBridge()
tdc = Tdc(vme,0xAA0000)
caenet = CaenetBridge(vme,0xF0000,0)
hv = HVModule.HVModuleFactory(2,caenet)
channel = hv.channel(2,10)
ttc = TtcVi(vme,0x555500)