[PLUG] Serial communication with dmm

Galen Seitz galens at seitzassoc.com
Sun Jan 7 20:35:42 UTC 2018


On 01/07/18 10:04, Denis Heidtmann wrote:
>>
>> On Mon, Jan 1, 2018 at 11:46 AM, Denis Heidtmann <
>> denis.heidtmann at gmail.com>
>> wrote:
>>
>>> I am looking into ways to examine the serial traffic to/from my dmm.
>>
> <snip>
> 
> I found a python script intended to interface with the mas-345:
> https://github.com/markrages/py_test_interface
> https://github.com/markrages/py_test_interface/blob/master/mas345.py
> 
> I gave it a try on my desktop (which has a serial port).  To get it to run
> I changed a couple of parameters and commented out one that was generating
> a no-such-parameter error.  Then I put it into debug mode so I could see
> the traffic from the meter.  The good news is it appears that the meter
> does report values as the documented protocol indicates.  How the
> communication is done is buried in the "serial" Python module. Someone who
> understands Python could learn from this; I cannot.

I've used the python serial module a few times.  Looking at that code, I
see a few things that strike me as unusual.  First is RTS is
cleared(line 125).  Normally both DTR and RTS would be set during serial
communication.  The second thing is that the meter apparently requires
the host to send 14 null characters(line 138) in order to cause it to
send its measurement data.  Finally, requiring two stop bits(line 117)
is unusual.  (Note that two stop bits and seven bit data is equivalent
to one stop bit and including a mark parity bit in eight bit data.)

Since its working with the python script, I suggest you continue using
python.  It's not as hard as it might at first appear.  I don't recall
your goal for this, but if you look at lines 169-197, I think you'll
begin to see how it might be modified to suit you.

galen
-- 
Galen Seitz
galens at seitzassoc.com



More information about the PLUG mailing list