LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa write skippy commands and Visa Read the return

Solved!
Go to solution

 

 Hello All,

I'm using an omega PX319-1kgi pressure transducer and Omega dp-8-pt display.

I have the display connected via the USB connection.  And the goal is to create a loop for logging the pressure data.  But for now I made test .vi to see what I'm outputting. 

 

The command is *G110 the carriage return is /r 

As far as I can tell this should read off what is on the display.

 

The Visa is opening and closing properly.  I think the problem is somewhere in the in the visa write, read, or property node between.   

 

If anyone could point me in the correct direction it would be appreciated.   I very new to labview, everything I've put together so far has been based on the reading comments and watching basic tutorials.

2018-05-17 18-21-57.jpg

0 Kudos
Message 1 of 6
(4,041 Views)
Solution
Accepted by topic author JonThorn

1. It is not "skippy".  It is SCPI.

2. That command is not a SCPI command.

3. Your command is wrong.  Even if in "\ Codes" display, you are using the wrong slash.  Right-click on your string constant and choose Visible Items->Display Style.  If it shows "n", then you are in normal display.  Change it to look like "\" (either click on the display style or right-click on the constant and choose "\ Codes".

4.  DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

(Still have not emphasized that enough.)  Reasons will follow.

5. Replace the VISA Open with the VISA Configure Serial Port.  Set the termination character to be 13 (0xD).  That is a Carriage Return.

6. REMOVE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (Have we picked up on my disdain for the Bytes At Port yet?)

Replace the Bytes At Port with a constant.  The value should be larger than any message you ever expect to read from the device.  I tend to use 50 or 100.

 

So here's how this works.  When you have the termination character enabled, the VISA Read will stop the read on the first of the following conditions: 1) It reads the number of bytes you told it, 2) it reads the termination character, 3) it times out.  So by setting the bytes to read to be really big, you are guaranteeing you will get your entire message.  When you use the Bytes At Port, you are creating weird race conditions with your instrument and not using the protocol to make your life simple.


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
Message 2 of 6
(4,023 Views)

Great, Thanks for the assist. 

 

Haha, with only some minor embarrassment on my part.  I was watching some tutorials on how to send commands that's where I heard "skippy".  The bytes came form an older program I scrapped together for reading returns from a load cell that required specific baud and byte constants be put in, I was trying to apply the same approach from something else I was able to get working. 

 

The output string  was not what I was expecting, but can correct for that with a few additional changes getting the output string to a number.

 

Your reply mentioned that when you have the termination character enabled, the VISA Read will stop the read when certain conditions are met.  The next part of what I need to do is to modify this to log data.  I was going to do this by running a loop.  

 

Will the the end condition stack up and end a loop while it is running?  Or will it reset because another command is sent by running the loop? 

 

As far as I can tell it is the latter but I still have to hook up a pump to change the pressure to make sure it is putting out more then the same number.

 

2018-05-18 09-19-37.jpg

 

0 Kudos
Message 3 of 6
(3,977 Views)

@crossrulz wrote:

1. It is not "skippy".  It is SCPI.

2. That command is not a SCPI command.

3. Your command is wrong.  Even if in "\ Codes" display, you are using the wrong slash.  Right-click on your string constant and choose Visible Items->Display Style.  If it shows "n", then you are in normal display.  Change it to look like "\" (either click on the display style or right-click on the constant and choose "\ Codes".

4.  DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

(Still have not emphasized that enough.)  Reasons will follow.

5. Replace the VISA Open with the VISA Configure Serial Port.  Set the termination character to be 13 (0xD).  That is a Carriage Return.

6. REMOVE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (Have we picked up on my disdain for the Bytes At Port yet?)

 


Tell us how you really feel about using  "Bytes at Port". 😛 

========================
=== Engineer Ambiguously ===
========================
Message 4 of 6
(3,970 Views)

@RTSLVU wrote:

Tell us how you really feel about using  "Bytes at Port". 😛 


I have found only 1 legitimate use for 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
0 Kudos
Message 5 of 6
(3,962 Views)

@JonThorn wrote:

Will the the end condition stack up and end a loop while it is running?  Or will it reset because another command is sent by running the loop?


Each time the VISA Read is called, it is looking for a termination character in the buffer.  Any previously read data is gone as far as VISA is concerned.  But since the unit responds to your request, you know there should be new data coming in.


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 6 of 6
(3,961 Views)