Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19969

Re: convert perl-script for voltcraft voltmeter to python [newbie]

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:sourceforge': 0.02; 'skip:# 20': 0.03; 'oh,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'subject:python': 0.10; 'comment:': 0.13; '-which': 0.16; 'bieber': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'message-id:@4ax.com': 0.16; 'received:wlfraed': 0.16; 'timeout': 0.16; 'true)': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wrote:': 0.18; 'bytes': 0.18; 'received:166': 0.18; 'url:home': 0.21; 'maybe': 0.21; "doesn't": 0.22; 'feb': 0.22; 'statement': 0.23; 'fine': 0.24; 'suspect': 0.24; 'obviously': 0.25; 'module': 0.26; 'work.': 0.27; 'says': 0.27; 'second': 0.28; 'sends': 0.29; 'class': 0.29; 'print': 0.29; 'definition': 0.30; 'jean': 0.30; 'pretty': 0.31; 'capture': 0.32; "isn't": 0.33; "won't": 0.33; 'too': 0.33; 'fri,': 0.34; 'header:X-Complaints-To:1': 0.34; 'character': 0.34; 'coding': 0.34; 'lee': 0.34; 'loop': 0.34; 'anything': 0.34; 'to:addr:python-list': 0.35; 'something': 0.35; 'subject:]': 0.36; 'received:org': 0.36; 'using': 0.37; 'doing': 0.38; 'data': 0.38; 'processing': 0.39; 'might': 0.40; 'to:addr:python.org': 0.40; 'your': 0.61; 'show': 0.66; 'serial': 0.71; 'dennis': 0.73; '-0800': 0.84; '>some': 0.84; 'fifteen': 0.84; 'marker': 0.84; 'meter': 0.84; 'streams': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: convert perl-script for voltcraft voltmeter to python [newbie]
Date Tue, 07 Feb 2012 12:44:36 -0500
References <d953c169-0656-46c1-a3ba-5387c9c06df8@t30g2000vbx.googlegroups.com> <8a475c9d-24ed-45a4-af9f-2ca826f9301d@m2g2000vbc.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host mobile-166-147-101-215.mycingular.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5506.1328637009.27778.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328637009 news.xs4all.nl 6934 [2001:888:2000:d::a6]:35919
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19969

Show key headers only | View raw


On Fri, 3 Feb 2012 05:11:54 -0800 (PST), Jean Dupont
<jeandupont115@gmail.com> wrote:

>As my request might have been too much asked, I have started doing
>some coding myself.
>I'm in doubt about the readline statement -which doesn't show anything
>received- as the meter sends continuously streams of 11 bytes

	Well, since readline() pretty much by definition wants a line-ending
character before returning, it obviously won't work. (Side comment:
readline() isn't even shown as part of the basic Serial class -- it is
in a class FileLike: http://pyserial.sourceforge.net/pyserial_api.html
-- oh wait.. fine print says that is a base class for Serial on non-io
module systems).

	What is the boundary marker for your 11-byte chunks? You may need to
do a synchronization loop using

	while ser2.read() != marker: continue

then go into main processing loop with

	data = ser2.read(11)

to capture a "chunk".

	Oh, BTW...

> $port->rts_active(0);
> $port->dtr_active(1);
...
> #$port->read_char_time(5);     # wait 5ms per character
> $port->read_const_time(200);   # 0.2 second per unfulfilled "read"

vs your

> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, timeout=15)

	Your timeout is FIFTEEN SECONDS!

	Suspect you want something like

ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE,
					serial.STOPBITS-ONE, timeout=0.200,
					dsrdtr = True)
and maybe also

ser2.setDTR(True)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

convert perl-script for voltcraft voltmeter to python [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-02 12:57 -0800
  Re: convert perl-script for voltcraft voltmeter to python [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-03 05:11 -0800
    Re: convert perl-script for voltcraft voltmeter to python [newbie] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-02-07 12:44 -0500
      Re: convert perl-script for voltcraft voltmeter to python [newbie] Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-07 11:47 -0800
    Re: convert perl-script for voltcraft voltmeter to python [newbie] Dietmar Schwertberger <news@schwertberger.de> - 2012-02-08 01:26 +0100
      Re: convert perl-script for voltcraft voltmeter to python [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-08 04:24 -0800
  Re: convert perl-script for voltcraft voltmeter to python [newbie] Terry Reedy <tjreedy@udel.edu> - 2012-02-06 23:21 -0500
    Re: convert perl-script for voltcraft voltmeter to python [newbie] Jean Dupont <jeandupont115@gmail.com> - 2012-02-07 11:44 -0800
      Re: convert perl-script for voltcraft voltmeter to python [newbie] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-02-07 17:57 -0500

csiph-web