LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read data from the Gaussmeter

Solved!
Go to solution

Hello,

 

I am trying to read data from the gaussmeter but I am getting problem while running program, the bytes read is atomically getting zero, Before running the program I was giving value of 1000 bytes read, after compiling the program bytes read is getting zero and no data is getting potted in the chart. Could you please give me your suggestion, Did I do mistake anywhere in the program. I am attaching the front panel and block diagram of my code. Could you please check it and looking forward for your help.

 

Thanks

Vijay

0 Kudos
Message 1 of 12
(1,743 Views)

Some recommendations:

- terminate the SCPI command with a line feed otherwise it will not be recognized

- remove the Bytes at Port property and throw a large number (say 1000) into the byte count terminal input

- define a more sensible timeout (10 seconds seems too much, 1 or 2 seconds are probably enough)

 

EDIT: the value of the bytes read indicator before running is irrelevant

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 12
(1,734 Views)

Do you have a manual or some documentation showing the communication details for this instrument?  It is hard to give any real advice without knowing how the communication works.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 12
(1,725 Views)

Hello Crozzrulz,

 

I am attaching the manual of my device could you please check it. My aim is to determine the magnetic flux density continuously, So I am using RS 232 cable to communicate with the device (SCPI Commands), I am using the VISA function to read continuous data. Actually, I am new to LabVIEW so I am not confident that my code implementation is completely correct or not. Could you please check it and please give me your suggestions to get the continuous data from the device by giving SCPI commands.

 

 Looking forward to hear from you

 

Thanks

Vijay

0 Kudos
Message 4 of 12
(1,715 Views)

I would say that the bytes at port before you run is important.  There are times when programs using serial ports get stopped oddly and there is data sitting at the port.  For this reason, as part of the init, we clear the write buffer by reading it until there is nothing else to read.

 

I would also suggest that you turn on slash codes with the SCPI command string so that you can see for sure that the \n or \r is there. 

 

In your target code where you will be doing a write then an immediate read you should put a Stall Data Flow for something like 10 ms or 50 ms after the write so that the instrument has time to respond.

 

Lastly I would suggest that you put an error in and error out on the front panel so that you can capture any error codes that come up.

0 Kudos
Message 5 of 12
(1,697 Views)

@Tom_Powers  ha scritto:

I would say that the bytes at port before you run is important.

The questioned value was "read bytes", which is an indicator, not "bytes at port" (at least this is what I understood). "read bytes" is only written, never read, so before running it's irrelevant.

 


@Tom_Powers  ha scritto:

In your target code where you will be doing a write then an immediate read you should put a Stall Data Flow for something like 10 ms or 50 ms after the write so that the instrument has time to respond.

 


If the termination character is enabled, there is no need to put a wait between write and read. VISA will wait for an answer (terminated by LF) within the full timeout.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 12
(1,692 Views)
Solution
Accepted by vijay0507

Ok, you have a few problems here.

 

1. The command you are writing is wrong.  You are sending "*READ?" when it should be ":READ?" (you used a star instead of a colon).

 

2. It appears like you did not terminate your command with a Line Feed.  It is really hard to tell when looking at a string in "normal" view.  You might want to change that to use "\ Codes" if you are going to include it in the string.  I just use Concatenate String with a Line Feed Constant to make sure it is at the end of the command.

 

3. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis).  I could go on a big giant rant here.  But to keep it really simple for you, you just need to tell the VISA Read to read more bytes than you ever expect in a response and the VISA Read will stop reading when it encounters the termination character (default is a Line Feed).  This will ensure you are getting the full response back and not part of a message.

 

So with that said, here is the code I recommend you start with.  Also attached is the VI saved in LabVIEW 2009, so you should be able to open it.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 7 of 12
(1,680 Views)

Hello Crossrulz,

 

Thank you so much for your suggestions and help. Its working now. But I have a small doubt when I try to plot the magnetic flux density  its recording in Tesla [T], and in the measurement instrument the values are showing in milliTesla [mT]. How do I convert the Tesla [T] into milliTesla [mT] in waveform chart. Could you please give me your suggestion. For your reference,  I am attaching a picture of my measurement in Tesla.

 

Thanks

Vijay

0 Kudos
Message 8 of 12
(1,609 Views)

The Y axis legend is just a text: you can simply edit it clicking on the text or opening the graph's Properties dialog.

I'm assuming that the displayed values are actually in mT.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 12
(1,606 Views)

Hello pincpanter,

 

Thank you so much for your suggestions and help. Actually, when I try to plot the magnetic flux density in waveform chart its recording in Tesla [T], and in the measurement instrument the values are showing in milliTesla [mT].  For example in Gaussmeter if it 40.6mT (milliTesla) and that same value is getting plotted in chart as 0.04T (Tesla). So my doubt is how do I convert the values in milliTesla in waveform chart same as instrument values. I have tried in chart properties to change Y-axis decimal values by dint get the positive result. Still the values are recording in Tesla in chart. Could you please let me know your suggestion. For your reference I am attaching the pictures. Looking forward to hear from you soon.

 

Thanks

Vijay

Download All
0 Kudos
Message 10 of 12
(1,568 Views)