LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA PROBLEM

Solved!
Go to solution

Hello,

 

I am writing a vi to acquire data from a Thurlby Thandar 1906 Multimeter. When I use Hyperterminal I can use the commands "LAD" (Get ready to talk) and READ? (Read the buffer). I can acquire the measured value from the unit.

 

When I run the following vi I find that it consistently reads 0.000 which is incorrect.

 

Can anybody see what I am doing wrong?

 

Nevicavi

0 Kudos
Message 1 of 9
(4,308 Views)

What is unusual about this vi is the following:

 

When I highlight execution I find the following. Values shown in diagram appear almost instantaneously. ie the 0.00e+0 seems to appear before the buffer has been read. I dont understand how this can be so as Labview is supposed to carry out operations from left-to-right?

 

Nevica

0 Kudos
Message 2 of 9
(4,299 Views)

Hi nevica,

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

When I highlight execution I find the following. Values shown in diagram appear almost instantaneously. ie the 0.00e+0 seems to appear before the buffer has been read. I dont understand how this can be so Labview is supposed to carry out operations from left-to-right?

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

labview code does not execute from Left - right. It follows dataflow model. As soon as data is available to all required terminal of a node it will execute.

Position of block does not matter.

About your problem, I don't see any error in the block diagram. it shows "Ok". Check if serial configuration is correct or not.

Like baud rate and all...

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 3 of 9
(4,290 Views)

Serial configuration is correct. Could it be something to do with line feeds?

 

Nevica

0 Kudos
Message 4 of 9
(4,286 Views)

Hello,

 

Where does the value highlighted below originate? How is it being read without first the VISA read command activating. The value highlighted appears almost instantaneoulsy the loop starts!

 

Nevica

 

Capture.JPG

0 Kudos
Message 5 of 9
(4,279 Views)

When I read the numbers of bytes read on the last read command I find that no bytes are being read.

 

I know that the miltimeter is being read as it beeps when this happens. Because of this I know that the VISA seetings are correct. Yet, it is reading the incorrect value.

 

Nevica

0 Kudos
Message 6 of 9
(4,271 Views)

Hi nevica,

 

That is not causing error in your code. Let me tell you again, When you run any code all inputs are available at the executing node, except the inputs which are output from some other node. In your case the value 0.00E+0 is nothing but input "Default" to the node. So it will be available at this node immediately when you run the code.Whereas String output from serial read function will appear when the read function executes.

Can you remove 1st two blocks and try your code. I am not sure this will work but just want you to try. Refer image.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 7 of 9
(4,259 Views)

Also try this

Write LAD first wait for few milliseconds then write READ? wait again and then use read function

This might work.I think your code executes before it could read from serial port.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 8 of 9
(4,257 Views)
Solution
Accepted by topic author nevica

Hello,

 

I have discovered what the problem is.

 

The instrument has been expecting a "line feed" instead of a "carriage return" as the instrument manual stated.

 

The vi works now!

 

Nevica

0 Kudos
Message 9 of 9
(4,236 Views)