Jump to content

Multimeter serial communication


Recommended Posts

Hi, I'm a beginner of Labview (8.2) and I'm trying to controll a Digital Multimeter DVM345DI ex Velleman (alias MAS34-xx ex Mastech I found both the vendors supply the same nstrument produced somewhere in China).

The instrument uses a RS232C serial interface that works with a software called Mas-View. The communication specs are the following:

RS232C Interface protocol

3-1. MAS34X series

Mode : 600,n,7,2

Format : Ascii Code

Total : 14 bytes

Whenever any one byte received from P/C, output 14 bytes.

BYTE 1-2 : MEASURING MODE (ex;DC,AC,OH,CA,TE...)

BYTE 4 : SIGN(-)

BYTE 5-9 : Decimal point and value

Current measurement value(ex;10.00, OL.,3.999)

BYTE 10-13 : Unit (ex; mV,A,KOHM,nF...)

BYTE 14 : Carriage Return

Note : Interval time over 1 second is required for stable

measuring data from the meter.

I also made a Matlab code that is working fine :

s = serial('COM4');

s.BaudRate=600;

s.StopBits=2;

s.Timeout=10;

s.Terminator='';

s.DataBits=7;

s.ReadAsyncMode = 'continuous';

get(s,{'BaudRate','DataBits','Parity','StopBits','Terminator'});

fopen(s);

fprintf(s,'D');

s.BytesAvailable;

out = fscanf(s) % es DC -0.000 V

fclose(s);

Now, I would like get the same thing with Labview. I did the code start.vi with a modified driver for the serial communication (both enclosed).

Nothing to do, I cannot succed. I suppose I have some parameters wrong in the .vi code. I always get:

Error -1073807253 occurred at VISA Read in start.vi

Possible reason(s):VISA: (Hex 0xBFFF006B) A framing error occurred during transfer.

I monitored all the three communications with Portmon. I have reported all the results in the spreadsheet file.

In my opinion something is wrong in the read part. It is also interesting that Mas-view and Matlab get the data in two different ways,but Labview cannot get the answer from the instrument. This makes me crazy !

Anyone can help me ? Whatever suggestion is wellcome, thanks.

Gianmarco

Download File:post-7095-1165066712.vi

Download File:post-7095-1165066765.vi

Download File:post-7095-1165067071.xml

Link to post
Share on other sites

Hi gianmarco,

I see some issues in your code, you tell VISA to wait for a termination character (the T-boolean), and specify this byte as 0x00 (a null-byte) but your specs say it should be a CR (0x0D).

You try to read 1024 bytes thought you'll only get 14 bytes per reading.

You specify XonXoff as flow control this doesn't show up in your specs

Why did you modify the VISA configurator?

Hopefully this code can help you:

post-2399-1165086997.png?width=400

Ton

Link to post
Share on other sites
Hi gianmarco,

I see some issues in your code, you tell VISA to wait for a termination character (the T-boolean), and specify this byte as 0x00 (a null-byte) but your specs say it should be a CR (0x0D).

You try to read 1024 bytes thought you'll only get 14 bytes per reading.

You specify XonXoff as flow control this doesn't show up in your specs

Why did you modify the VISA configurator?

Hopefully this code can help you:

post-2399-1165086997.png?width=400

Ton

Hi Ton you are right : these parameters were modified later. Anyway if you put terminator character "False" and you read only 14 bytes you get the same framing error (1073807339). The same is true for flow control that should be 0.

I 've enclosed again the start.vi with the parameters in line with what you said. Sorry for my mistake.

The reason why I modified the Visa configurator is to modify XonXoff characters. It was the only way I found.

Gianmarco

Download File:post-7095-1165146406.vi

Link to post
Share on other sites

Hi Gianmarco,

A framing error is mostly meaning there is something wrong with the serial settings.

Have you tried other settings?

A good thing to start with is MAX, if you succeed to communicate with the device from there you will get it in LV right.

Second pass the VISA-resource from one subvi into the next, I'm not sure if it is usefull but better safe than sorry.

You should rise your timeout, in MATLAB you use 10 seconds and here just 1.

Ton

PS don't quote a full post in a reply

Link to post
Share on other sites

Hi Gianmarco,

some multimeters abuse handshake lines DTR and RTS to supply builtin opto couplers with power.

To investigate this please Unplug Multimeter. Close LabVIEW and run the Mas-VIEW program.

One way to verify states of lines is to measure voltage at pin4=DTR and pin7=RTS versus pin5=ground.

Or investigate states of lines with MAX by opening VISA Test Panel of the Com-Port.

Please report your results to the forum and we can give further help how to control handshake lines

out of LabVIEW by a property node.

Your Start.vi executes write and read in parallel.

Modify like tcplomp did. ...pass the VISA-resource from one subvi into the next.

Manfred

Link to post
Share on other sites
Hi Gianmarco,

some multimeters abuse handshake lines DTR and RTS to supply builtin opto couplers with power.

To investigate this please Unplug Multimeter. Close LabVIEW and run the Mas-VIEW program.

One way to verify states of lines is to measure voltage at pin4=DTR and pin7=RTS versus pin5=ground.

Or investigate states of lines with MAX by opening VISA Test Panel of the Com-Port.

Please report your results to the forum and we can give further help how to control handshake lines

out of LabVIEW by a property node.

Your Start.vi executes write and read in parallel.

Modify like tcplomp did. ...pass the VISA-resource from one subvi into the next.

Manfred

Hi Manfred,

you are very right! That's what I did following also the suggestions of Ni-support team (italy). I measured the voltage of all the pins during a working transmission by the multimeter itself. I understood that the working programs (Mas-view and Matlab) setted the RTS to null instead Labview put it to high. So I modified it and ...now it 's working

I suppose this is not a very common serial transmission procedure but that is.Thanks to people that helped me.

For the people intered in I enclosed a couple of vis for a working communications.

Gianmarco

Download File:post-7095-1165435177.vi

Download File:post-7095-1165435195.vi

Link to post
Share on other sites
  • 2 years later...

Hy,i have the same problem like gianmarco,and when i download the attachemnts and try to run the .vi it said that SubVi is missing and can not be loaded,can someone help me?The thing that i should do is to recive data from a DMM MAS345 via rs232,if someone knows cand contact me at mada_7070@yahoo.com need help so badly,thanks!!!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.