Path: csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subsequent': 0.04; 'great.': 0.07; 'subject:skip:c 10': 0.07; 'api': 0.09; 'python': 0.09; 'buffer.': 0.09; 'bytes,': 0.09; 'handler,': 0.09; 'ioerror:': 0.09; 'port,': 0.09; 'read-write': 0.09; 'sure,': 0.09; 'that).': 0.09; 'cc:addr:python-list': 0.10; 'do,': 0.15; 'library': 0.15; '(but': 0.15; '(where': 0.15; 'dec': 0.15; '"n"': 0.16; 'command,': 0.16; 'comments:': 0.16; 'handshake.': 0.16; 'measured': 0.16; 'received:mac.com': 0.16; 'rs232': 0.16; 'sign.': 0.16; 'timed': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'received:10.0.1': 0.17; 'typical': 0.17; 'handles': 0.18; '>>>': 0.18; 'appears': 0.18; '(or': 0.18; 'windows': 0.19; 'versions': 0.20; 'equivalent': 0.20; 'written': 0.20; 'trying': 0.21; 'meant': 0.21; 'back.': 0.22; 'driven': 0.22; 'explicit': 0.22; 'logical': 0.22; 'subject:problem': 0.22; "i'd": 0.22; 'seems': 0.23; 'cc:2**1': 0.24; 'command': 0.24; 'specifically': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; '(which': 0.26; 'skip:" 20': 0.26; 'skip:m 30': 0.26; '(most': 0.27; 'am,': 0.27; 'older': 0.27; 'newer': 0.27; "doesn't": 0.28; 'trouble': 0.28; '"do': 0.29; 'decimal': 0.29; 'equipment.': 0.29; 'jean': 0.29; 'python"': 0.29; 'restart': 0.29; 'surprised': 0.29; 'trigger': 0.29; 'url:mailman': 0.29; "i'm": 0.29; 'maybe': 0.29; 'connection': 0.30; 'bus': 0.30; 'waste': 0.30; 'writes': 0.30; 'expect': 0.31; 'code': 0.31; '(and': 0.32; 'asking': 0.32; 'url:python': 0.32; 'file': 0.32; 'skip:- 10': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'indexed': 0.33; 'traceback': 0.33; 'received:10.0': 0.33; 'problem': 0.33; 'another': 0.33; 'that,': 0.34; "can't": 0.34; 'changed': 0.34; 'received:17': 0.35; 'pm,': 0.35; 'something': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'cc:no real name:2**1': 0.36; 'characters': 0.36; "didn't": 0.36; 'subject:with': 0.36; 'best,': 0.37; 'does': 0.37; 'quite': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'received:10': 0.38; 'url:en': 0.38; 'several': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'subject:-': 0.40; 'url:mail': 0.40; 'from:no real name:2**0': 0.60; 'skip:u 10': 0.60; 'link': 0.60; 'most': 0.61; 'national': 0.61; 'back': 0.62; 'provide': 0.62; 'charset:windows-1252': 0.65; '10,000': 0.65; '26,': 0.65; 'serial': 0.66; 'study': 0.66; 'direct': 0.69; 'link:': 0.75; '*appears*': 0.84; 'instruments.': 0.84; 'repeat.': 0.84; 'for).': 0.91; 'poorly': 0.93 MIME-version: 1.0 Content-type: text/plain; charset=windows-1252 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.9.8185,1.0.431,0.0.0000 definitions=2012-12-06_06:2012-12-06, 2012-12-06, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001 definitions=main-1212060131 Subject: Re: problem with usbtmc-communication From: wrw@mac.com In-reply-to: <123edfab-b46a-4a47-8b73-3f47e807e074@c16g2000yqi.googlegroups.com> Date: Thu, 06 Dec 2012 15:15:09 -0500 Content-transfer-encoding: quoted-printable References: <05927d41-f73f-4fef-9a6d-4133e5c7d86a@n8g2000vbb.googlegroups.com> <0910382a-08df-4325-806f-a4c3cdf6bd7b@f17g2000vbz.googlegroups.com> <123edfab-b46a-4a47-8b73-3f47e807e074@c16g2000yqi.googlegroups.com> To: Jean Dubois X-Mailer: Apple Mail (2.1499) Cc: python-list@python.org, wrw@mac.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 87 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1354824932 news.xs4all.nl 6983 [2001:888:2000:d::a6]:51624 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34426 On Dec 6, 2012, at 2:41 PM, Jean Dubois wrote: > On 6 dec, 15:50, w...@mac.com wrote: >> On Dec 6, 2012, at 8:50 AM, Jean Dubois = wrote: >>=20 >> [byte] >>=20 >>=20 >>> It seems there is some misunderstanding here. What I meant with how >>> to "do the equivalent in Python" refered to "reading characters >>> rather than lines". >>> I have written working code myself for another Keithleu which does = use >>> RS232 for communication. The problem now is specifically for the new >>> Keithley which doesn't allow RS232 but only USB-communication over >>> usbtmc. So if the "buffer-problem" could be changed by reading >>> characters that would be great. >>=20 >>> regards, >>> Jean >>=20 >>> -- >>> http://mail.python.org/mailman/listinfo/python-list >>=20 >> Sorry about the misunderstanding (and subsequent waste of bandwidth). = However, if you will look at the serial reads and writes in that = handler, you will see that it does things like "serial.read(n)" where = "n" is an explicit number, the number of bytes to be read from the = serial buffer. >>=20 >> -Bill > I tried changing measurementcurr=3Dusbkeith.readline() to > measurementcurr=3Dusbkeith.read(10000) > but this leads to trouble with the usbtmc-thing: >=20 > Measured current 1: > Traceback (most recent call last): > File "./keith2200rev2.py", line 26, in > measurementvolt=3Dusbkeith.read(10000) > IOError: [Errno 110] Connection timed out >=20 > and hereafter I need to restart the Keithley...:-( >=20 > regards, > Jean > --=20 > http://mail.python.org/mailman/listinfo/python-list Several comments: 1) I can't be sure, but that would seem to be asking the Keithley to be = providing 10,000 readings. I don't know about the GPIB bus (which this = USBTMC library seems to be trying to emulate), but most serial devices = expect to provide one answer per read-write handshake. That is, you = send one read command and get one answer back. That answer may contain = several bytes, but I'd be surprised it it contained 10,000. The typical = cycle is something like send-an-initialize, read-status, = send-mode-set-up, read-status, send trigger command, read-answer=85 = lather and repeat. (Or some logical equivalent of all that). On the = assumption that the USBTMC API handles most of that, I'd try = usbkeith.read(n) where "n" is the number of decimal digits you expect to = get back plus sign. ------------- 2) I took a quick look at the Keithley and National Instruments web = sites (where the documentation is at best, VERY poorly indexed and hard = to search for). USBTMC *appears* to be a software layer designed to = allow newer Tektronix and Keithley instruments to be driven using older = software that drove GPIB equipment. To make matters worse, if I'm = reading it right (I didn't study in detail) it appears to ALSO be = providing a GPIB-like API to Windows versions of National Instruments = LabView. 3) If I understand what you are trying to do, you want to go straight = from python to the Keithley USB port, without detouring (USB-to-GPIB and = GPIB back to USB). 4) I did find (but did not try to read in detail) the following link: = http://www.ni.com/white-paper/4478/en which documents direct USB = control of instruments. The python serial library provides quite = transparent control of reading and writing to the USB interface. Maybe = following this link will get you going. -Bill=