Data acquisition

Paul Simon psimon at sonic.net
Tue Oct 25 18:06:31 EDT 2011


"spintronic" <sidorenko.andrey at gmail.com> wrote in message 
news:362e368f-829e-4477-bcfc-c0650d231029 at j7g2000yqi.googlegroups.com...
> Dear friends,
>
> I have a trouble with understanding the following. I have a very short
> script (shown below) which works fine if I "run" step by step (or line
> by line) in Python shell (type the first line/command -> press Enter,
> etc.). I can get all numbers (actually, there are no numbers but a
> long string, but this is not a problem) I need from a device:
>
> '0.3345098119,0.01069121274,0.02111624694,0.03833379529,0.02462816409,0.0774275008,0.06554297421,0.07366750919,0.08122602002,0.004018369318,0.03508462415,0.04829900696,0.06383554085, 
> ...'
>
> However, when I start very the same list of commands as a script, it
> gives me the following, which is certainly wrong:
>
> [0.0, 0.0, 0.0, 0.0, 0.0,...]
>
> Any ideas? Why there is a difference when I run the script or do it
> command by command?
>
> ===========================
> from visa import *
>
> mw = instrument("GPIB0::20::INSTR", timeout = None)
>
> mw.write("*RST")
> mw.write("CALC1:DATA? FDATA")
>
> a=mw.read()
>
> print a
> ===========================
> (That is really all!)
>
>
> PS In this case I use Python Enthought for Windows, but I am not an
> expert in Windows (I work usually in Linux but now I need to run this
> data acquisition under Windows).

I'm almost certain that there is a turnaround timing issue that is causing 
the problem.  These are common problems in data aquisition systems.  The 
simplest solution is to loop and wait for end of line from the sending end 
and if necessary put in a time delay.  After receiving the data, check the 
received data for correct format, correct first and last characters, and if 
possible, check sum.  I've worked through this problem with rs-485 data 
collection systems where there is no hand shaking and would not be surprised 
to expect the same even with rs-232.

Paul Simon 





More information about the Python-list mailing list