Blame view

instruments/PM100D.py 1.09 KB
91efd0ebc   mer0m   Add files via upload
1
2
3
4
5
6
7
  from abstract_instrument import abstract_instrument
  import os
  
  #==============================================================================
  
  ALL_VAL_TYPE = ['PWR']
  ALL_CHANNELS = ['1']
9058343c5   bmarechal   some minor fixes
8
  ADDRESS = "/dev/usbtmc0"
91efd0ebc   mer0m   Add files via upload
9
10
11
12
13
  CONF_VAL_TYPE = ['PWR']
  
  #==============================================================================
  
  class PM100D(abstract_instrument):
9058343c5   bmarechal   some minor fixes
14
15
      def __init__(self, channels, vtypes, address):
          self.address = address
501ae8f66   bmarechal   -
16
          self.channels = channels
91efd0ebc   mer0m   Add files via upload
17
18
19
20
21
          self.vtypes = vtypes
  
      def model(self):
          #self.send("*IDN?")
          #return self.read()
501ae8f66   bmarechal   -
22
          return "PM100D"
91efd0ebc   mer0m   Add files via upload
23
24
  
      def connect(self):
9058343c5   bmarechal   some minor fixes
25
26
          print('Connecting to device @%s...' %(self.address))
          self.FILE = os.open(self.address, os.O_RDWR)
91efd0ebc   mer0m   Add files via upload
27
28
          print('  --> Ok')
          print(self.model())
501ae8f66   bmarechal   -
29
          self.configure()
91efd0ebc   mer0m   Add files via upload
30
31
  
      def configure(self):
501ae8f66   bmarechal   -
32
          pass
91efd0ebc   mer0m   Add files via upload
33
34
35
36
37
38
39
40
41
42
43
44
45
  
      def getValue(self):
          self.send("READ?")
          return self.read()
  
      def read(self):
          return os.read(self.FILE, 300)
  
      def disconnect(self):
          self.send('*RST')
  
      def send(self, command):
          os.write(self.FILE, command)