Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19924
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'url:sourceforge': 0.02; 'skip:# 20': 0.03; 'python:': 0.05; 'modules.': 0.07; 'received:verizon.net': 0.07; 'terry': 0.07; 'python': 0.08; 'port,': 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; 'output': 0.10; 'python?': 0.15; '"couldn\'t': 0.16; 'reedy': 0.16; 'stdout': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'header:In-Reply-To:1': 0.22; 'defined': 0.24; 'command': 0.24; 'parameters': 0.25; 'guess': 0.26; 'code.': 0.26; 'module': 0.26; 'script': 0.28; 'second': 0.28; 'print': 0.29; 'connected': 0.29; 'pm,': 0.29; 'jean': 0.30; 'url:projects': 0.30; 'pretty': 0.31; 'actually': 0.31; 'there': 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.34; 'character': 0.34; 'skip:# 10': 0.34; 'setting': 0.34; 'anything': 0.34; 'someone': 0.34; 'to:addr:python-list': 0.35; 'properties': 0.36; 'subject:]': 0.36; 'received:org': 0.36; 'but': 0.37; 'connects': 0.38; 'could': 0.38; 'should': 0.38; 'open': 0.38; 'correctly': 0.39; 'unless': 0.39; "i'd": 0.39; 'url:source': 0.39; 'to:addr:python.org': 0.40; 'supply': 0.61; 'below': 0.62; 'skip:$ 10': 0.66; 'serial': 0.71; 'usb': 0.73; 'usb.': 0.84; 'ports.': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: convert perl-script for voltcraft voltmeter to python [newbie] |
| Date | Mon, 06 Feb 2012 23:21:24 -0500 |
| References | <d953c169-0656-46c1-a3ba-5387c9c06df8@t30g2000vbx.googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-74-109-121-73.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
| In-Reply-To | <d953c169-0656-46c1-a3ba-5387c9c06df8@t30g2000vbx.googlegroups.com> |
| 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.5487.1328588509.27778.python-list@python.org> (permalink) |
| Lines | 58 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1328588509 news.xs4all.nl 6913 [2001:888:2000:d::a6]:40093 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:19924 |
Show key headers only | View raw
On 2/2/2012 3:57 PM, Jean Dupont wrote:
> I'd like to read in the output of a voltcraft vc960 voltmeter
> connected to a usb-port.
> I found the perl-script below but I'd like to accomplish the same with
> python:
The script below is for an old-fashioned, slow, multiple-pin serial
port, not usb. I don't know anything about interfacing through usb.
Recheck what the voltmeter actually connects to.
> I guess I have to use the module serial but I don't know how I should
> set the serial parameters so they are the same as in the perl-script.
> Could someone supply me the command for setting the serial-parameters
> correctly in Python?
Last I know, pyserial is also for old serial ports. Setting the
properties should be pretty obvious from the manual or code.
There are also python usb modules.
http://sourceforge.net/projects/mysql-python/?source=directory
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use Device::SerialPort;
>
> die("Usage: $0 /dev/ttyS0\n") unless $#ARGV == 0;
>
> my ($devicepath) = @ARGV;
>
> my $port = new Device::SerialPort($devicepath);
> die "Couldn't open serial port" if ! defined $port;
>
> $port->baudrate(2400);
> $port->databits(8);
> $port->parity("none");
> $port->stopbits(1);
> $port->handshake("none");
> $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"
> call
> $| = 1; # autoflush STDOUT
> while(1) {
> my ($nin, $in) = $port->read(255);
> print $in;
> }
>
> $port->close;
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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