LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown error with visa write

Hello, i'm trying to make a vi with simple functions to start learning how visa write/read works. Im trying to use this vi with a Keysight 34461A dmm. When i run it, the initialization case goes fine but the code stops at the write in the DC measurement case. Can someone explain what am i doing wrong and how can i fix it? Thank you

 

EDIT: i removed all the visa read functions and now the program runs from start to finish, but it still doesnt change the values shown on the multimeters.

0 Kudos
Message 1 of 8
(1,669 Views)

Hi domcorrado,

 


@domcorrado wrote:

Hello, i'm trying to make a vi with simple functions to start learning how visa write/read works. Im trying to use this vi with a Keysight 34461A dmm. When i run it, the initialization case goes fine but the code stops at the write in the DC measurement case. Can someone explain what am i doing wrong and how can i fix it?


Does it really stop while executing the VISAWrite function? (This would be very uncommon…)

Why do you wire the "bytes written" output of the VISAWrite to the "bytes to read" of the following VISARead function? How are both related?

 

Do you really want to place all this functionality into just one ActionEngine? This is a very unusual approach to define a device driver with a nice API. Did you take a look at other device drivers found at www.ni.com/idnet ?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(1,619 Views)

Yeah, I have to agree with GerdW here, trying to make this an all inclusive Action Engine is not a good idea to begin with...

 

I know when you are first starting out it seems like a good idea to just have one VI that does everything, but generally it's not.

 

With most instruments you really need to follow these basic steps

  1. Initialize (Open a VISA session, reset, ID query, etc.)
  2. Configure measurement(s) (type, range, triggering etc.)
  3. Acquire measurement
  4. Close instrument (Visa Session)
     

Don't try to do all this in one Action Engine VI

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 8
(1,607 Views)

Hello GerdW,

yes I know that it’s not the optimal way to do this but my teacher is making me doing it this way and then insert multiple of this vi as subvis in another “test” vi just to show us how it works. 

about the bytes written/read functions: it just seemed the right thing to do to me since this way the read function is gonna read exactly the amount of bytes I write. Does it not work this way? Either way as I said, if I remove the all the visa reads, the vi works but it doesn’t really change the values on the multimeter as I want.

0 Kudos
Message 4 of 8
(1,585 Views)

Hi domcorrado,

 


@domcorrado wrote:

about the bytes written/read functions: it just seemed the right thing to do to me since this way the read function is gonna read exactly the amount of bytes I write. Does it not work this way?


Well, let's go through an arbitrary example:

  • VISAWrite("Read?") will write 5 chars to your device.
  • The device might answer with "1.23456e1 V" (which are 11 chars), but with your method you only read the first 5 chars…

Do you still think it "works this way"?

 

At VISARead you need to request atleast the number of bytes that you expect from your device. Read the manual of your device to know how many chars to expect. (In general when you use a TermChar for communication then you should request a much larger number of bytes like "999" as the VISARead will automatically stop to read at the TermChar…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(1,564 Views)

@GerdW wrote:

Hi domcorrado,

 


@domcorrado wrote:

about the bytes written/read functions: it just seemed the right thing to do to me since this way the read function is gonna read exactly the amount of bytes I write. Does it not work this way?


Well, let's go through an arbitrary example:

  • VISAWrite("Read?") will write 5 chars to your device.
  • The device might answer with "1.23456e1 V" (which are 11 chars), but with your method you only read the first 5 chars…

Do you still think it "works this way"?

 

At VISARead you need to request atleast the number of bytes that you expect from your device. Read the manual of your device to know how many chars to expect. (In general when you use a TermChar for communication then you should request a much larger number of bytes like "999" as the VISARead will automatically stop to read at the TermChar…)


Just to be clear, "999" is not a magic number or a limit of some sort; you may use "1000" if you want to.  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 8
(1,549 Views)

Hello, I’m back after a while and I tried using yor advice for bytes. The code still goes in timeout, I also tried to use the “bytes at source” visa property node but it gives me error. At this point I don’t know what to do 

0 Kudos
Message 7 of 8
(1,510 Views)

@domcorrado wrote:

Hello, I’m back after a while and I tried using yor advice for bytes. The code still goes in timeout, I also tried to use the “bytes at source” visa property node but it gives me error. At this point I don’t know what to do 


Do you see anything wrong here?

Capture.png

"CONF:CURR:DC\s1,0.001TRIG:SOUR\sEXT;SLOP\sPOSINITFETC?\s0.000000\s"  Because I know how SCPI commands are formatted and can read the language I can state the query TRIGger:SLOPe POSINITFETCH? will result in a system error on the device.  comma delimited parameters are also illegal and 0.000000 is meaningless. 

 

And!!! you did not wire "Value In": to the connector pane! so how would you change Value? 

 

There are all kinds of "Wrong Things" in the other cases too. 

  • Did you read the manual for that device?
  • Did you look at the examples in the instrument driver?

You can actually SEARCH the Instrument Driver Network right from any LabVIEW panel by launching the driver wizard Menu..Help>>Find Instrument Driver...It will take you right here

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 8
(1,499 Views)