[Tutor] Fwd: Re: Lost message re serial comms

Alan Gauld alan.gauld at btinternet.com
Sun Feb 1 15:28:57 CET 2015


This was the problematic serial question.

*From:*Doug Basberg [mailto:dbasberg at comcast.net]
*Sent:* Friday, January 30, 2015 5:29 PM
*To:* 'tudor at python.org'
*Subject:* doing rs232 serial with binary data ?? with pyserial??

Hello group;

I am new to python and worked mostly in C & C++ (and assembly).  I do 
embedded controls and usually use the internet or LAN to log data and do 
controls.

So, in Python I found pyserial and wish to use it to send binary to 
controlled devices (in this case to a Modbus protocol solar charge 
controller (TriStar TS-60).

In C++ I would setup ‘structs’ or class attributes to hold the byte 
oriented commands and controller responses and then send them to rs232 
as binary.  I do not see how to do that with pyserial.

What I need is to send and receive binary (not strings) over rs232.  In 
this case from/to a Raspberry Pi (RPI) controller to/from the solar 
charge controller.  The RPI runs apache server to handle the network.

Any suggestions will be greatly appreciated.  I have been using 
Python2.7 so far.

Thanks

Doug





More information about the Tutor mailing list