MATES / Modular Automatic Test Equipment System API  2.5.0.0
mates_test_09.py
1 import mates
2 with mates.Mates("proxy.mon", 1) as m:
3  if m.discover_node(m.mates_dac5_mk1_2):
4  # Set to ~0.5 V.
5  value = int((0.5 / 5.0) * 0x10000)
6  print("Setting raw DAC value: {0}".format(value))
7  m.set_dac_raw(m.mates_dac5_mk1_2, 39, value & 0xFFFF)
8 
9  # When setting out of range exception is raised.
10  try:
11  m.set_dac_raw(m.mates_dac5_mk1_2, 39, 0xFFFF + 1)
12  except mates.MatesException as e:
13  print("Error setting DAC:")
14  print(e)