[PLUG] Serial communication with dmm
Denis Heidtmann
denis.heidtmann at gmail.com
Sun Jan 7 22:18:55 UTC 2018
My goal is to be able to get data from the dmm using my laptop, which has
only USB. I have an RS-232--USB adapter. Eventually I want to make the
choices more friendly.
Later today I will study the details of your observations. The protocol I
have seen described elsewhere says the host needs to send a single byte
(H?) to get the dmm to send one reading. I had to change two time values
and remove the setTimeout line to get it to work. At present it locks the
meter for some time. I expect that is because the host is sending bytes
too fast, causing the meter to try to respond before it is ready, a
difficulty I saw referenced in another description of how to deal with this
meter.
Thanks for looking at the code.
-Denis
On Sun, Jan 7, 2018 at 12:35 PM, Galen Seitz <galens at seitzassoc.com> wrote:
> 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
> _______________________________________________
> PLUG mailing list
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
More information about the PLUG
mailing list