How to use the pyvisa.vpp43 function in PyVISA

To help you get started, we’ve selected a few PyVISA examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heeres / qtlab / instrument_plugins / IVVI.py View on Github external
def _open_serial_connection(self):
        '''
        Opens the ASRL connection using vpp43
        baud=115200, databits=8, stop=one, parity=odd, no end char for reads

        Input:
            None

        Output:
            None
        '''
        logging.debug('Opening serial connection')
        self._session = vpp43.open_default_resource_manager()
        self._vi = vpp43.open(self._session, self._address)

        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 115200)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS,
            vpp43.VI_ASRL_STOP_ONE)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY,
            vpp43.VI_ASRL_PAR_ODD)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN,
            vpp43.VI_ASRL_END_NONE)
github heeres / qtlab / source / lib / visafunc.py View on Github external
def get_navail(visains):
    '''
    Return number of bytes available to read from visains.
    '''
    return vpp43.get_attribute(visains, vpp43.VI_ATTR_ASRL_AVAIL_NUM)
github heeres / qtlab / instrument_plugins / SMS.py View on Github external
def _open_serial_connection(self):
        '''
        Opens the ASRL connection using vpp43
        baud=19200, databits=8, stop=one, parity=even, no end char for reads

        Input:
            None

        Output:
            None
        '''
        logging.debug(__name__ + ' : opening connection')
        self._session = vpp43.open_default_resource_manager()
        self._vi = vpp43.open(self._session, self._address)

        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 19200)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS,
            vpp43.VI_ASRL_STOP_ONE)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY,
            vpp43.VI_ASRL_PAR_EVEN)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN,
            vpp43.VI_ASRL_END_NONE)
github heeres / qtlab / instrument_plugins / SMS.py View on Github external
def _read_buffer(self):
        '''
        Returns a string containing the content of the buffer

        Input:
            None

        Output:
            buffer (string) : data in buffer
        '''
        logging.debug(__name__ + ' : Reading buffer')
        tekst = vpp43.read(self._vi,vpp43.get_attribute(self._vi,
            vpp43.VI_ATTR_ASRL_AVAIL_NUM))
        sleep(0.05)

        if (tekst==''):
            return tekst
        elif (tekst[0]=='E'):
            logging.error(__name__  + ' : An error occurred during \
                readout of instrument : ' + tekst)
        else:
            return tekst
github heeres / qtlab / instrument_plugins / IVVI.py View on Github external
def _open_serial_connection(self):
        '''
        Opens the ASRL connection using vpp43
        baud=115200, databits=8, stop=one, parity=odd, no end char for reads

        Input:
            None

        Output:
            None
        '''
        logging.debug('Opening serial connection')
        self._session = vpp43.open_default_resource_manager()
        self._vi = vpp43.open(self._session, self._address)

        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_BAUD, 115200)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_DATA_BITS, 8)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_STOP_BITS,
            vpp43.VI_ASRL_STOP_ONE)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_PARITY,
            vpp43.VI_ASRL_PAR_ODD)
        vpp43.set_attribute(self._vi, vpp43.VI_ATTR_ASRL_END_IN,
            vpp43.VI_ASRL_END_NONE)
github CampbellGroup / common / lib / servers / GPIB_server / gpib_server_v1.11.py View on Github external
def _doRead(bytes):
            
            if bytes is None:
                ans = instr.read()
            else:
                ans = vpp43.read(instr.vi, bytes)        
            return ans
github heeres / qtlab / instrument_plugins / Zaber_TNM.py View on Github external
def _clear_buffer(self):
        navail = vpp43.get_attribute(self._visa.vi, vpp43.VI_ATTR_ASRL_AVAIL_NUM)
        if navail > 0:
            reply = vpp43.read(self._visa.vi, navail)
github heeres / qtlab / instrument_plugins / SMS.py View on Github external
Input:
            tekst (string) : data to be written to the instrument

        Output:
            None
        '''
        logging.debug(__name__ + ' : Start running _write_to_instrument with:' + tekst)
        # clear buffer
        logging.debug(__name__ + ' : clearing buffer')
        restbuffer = self._read_buffer()
        sleep(0.05)
        if (restbuffer!=''):
            logging.error(__name__ + ' : Buffer contained unread data : ' +
                restbuffer)
        logging.debug(__name__ + ' : writing to vpp43')
        vpp43.write(self._vi, tekst)
        sleep(0.05)