예제 #1
0
 def __init__(self, axisnum, bus=None):
     if type(bus) is str:
         # if only a device name is given, create a serial instance
         bus = Serial(bus, baudrate=19200,
                      timeout=10, rtscts=1,
                      term_chars="\r\n")
     super(ESP300_stage, self).__init__(axisnum, bus)
예제 #2
0
    def __init__(self, port='/dev/ttyUSBgpib', log=False):
        # create a serial port object
        self.bus = Serial(port, baudrate=115200, rtscts=1, log=log)
        # if this doesn't work, try settin rtscts=0

        # flush whatever is hanging out in the buffer
        self.bus.readall()

        # don't save settings (to avoid wearing out EEPROM)
        self.savecfg = False

        # do common startup routines
        super(PrologixUSB, self).__init__()
예제 #3
0
 def __init__(self, bus=None):
     if bus is None:
         bus = '/dev/ttyS0'
     if type(bus) is str:
         from wanglib.util import Serial
         bus = Serial(bus, baudrate=19200, rtscts=True, term_chars='\n')
     self.bus = bus
     self.wfmpre = self._parameterset(
         bus,
         prefix='WFMP:',
         strs=('ENCDG', 'BN_FMT', 'BYT_OR', 'XUNIT', 'YUNIT'),
         floats=('XZERO', 'XINCR', 'YOFF', 'YZERO', 'YMULT'),
         ints=('BYT_NR', 'BIT_NR', 'NR_PT', 'PT_OFF'))
     self.acquire = self._parameterset(bus,
                                       prefix='ACQ:',
                                       strs=('MODE', 'STOPA'),
                                       ints=('NUMAVG', 'NUMENV'),
                                       bools=('STATE', ))
예제 #4
0
    def __init__(self, addr=None):
        """
        Connect to the spectrometer and initialize its hardware.

        :param addr: the serial interface where the
                     spectrometer is found.
                     Default: ``/dev/ttyUSB0``

        """

        if addr is None:
            addr = self._default_location
        self.bus = Serial(addr, timeout=10, baudrate=19200)

        try:
            self.init_hardware()  # try to initialize hardware.
        except InstrumentError as err:
            print("%s, rebooting once..." % err)
            self.reboot()  # in case of trouble, reboot
            self.init_hardware()  # and try again.