can write to rs232 serial instrument but can't read from it
Question: I have an rs232 serial device and I am trying to read and write to it using
python with pyVISA. I am able to write my commands to it using "write" but I
If I try to us "read" or "ask" I get a timeout error.

I can read and write to it easily through labview or tera term but I can't
read using python.

Here is the python code that is not working:

    
    
    import visa as v
    si = v.SerialInstrument("COM1", delay = 0.1)
    si.clear()
    si.timeout = 3 
    si.baud_rate = 9600 
    si.data_bits = 8
    si.stop_bits = 1
    
    command = '0'
    while command != 'end':
        rorw = raw_input('ask, read, or write? >>')
        command = raw_input('enter command code >>')
        if rorw == 'write':
            write1 = si.write(command)
            print write1
        elif rorw == 'read':
            read1 = si.read()
            print read1
        else:
            ask1 = si.ask(command)
            print ask
    


Answer: My guess is you have a termchar issue. try set term_chars to \n or \r\n If
this doesnt work serial communication is very easy with pyserial. You will
want to define a custom method equivalent to pysvisa's ask using write and
readline and probably a **del** method to close the port if anything goes
wrong Good luck

