LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa Error

Hello,  I'm developing a driver for the DSA1030A. I created a state machine to handle the functions I need of the spectrum analyzer. The problem is that when for example I send this command %.;FREQ: STAR %g to the SA it works properly only the first time, infact at the second execution of the while cicle I got the error shown in figure:

 

visa error.PNG

0 Kudos
Message 1 of 11
(3,224 Views)

Hi inu,

 

the error message is quite clear: "invalid reference".

Somewhere along your DATAFLOW you forgot the correct reference (or do you close that in between?)...

Use some (highlight) debugging to find the problem!

 

Btw.

- there is no "while cicle" in your picture.

- using more than one event structure in one VI might lead to problems

- sequence structure seems unneeded as "DATAFLOW rulez"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(3,216 Views)

mmm no that's the problem I don't close the VISA in that point...

attached there is the VI on which I'm working.

The state machine is thought in this way:

Apri_sessione --> the VISA is opened. If an error occurs it goes to Manage_Error if not it repeat the state until it is changed by the user

Manage_Error --> show in 1 cluster the different tipes of errors that can occurr and goes to Chiudi_Sessione

Chiudi_Sessione --> the Visa is closed. Here I tried to handle the "wrong" click by the user so that if by mistake the user clicks on Chiudi_Sessione he can decide to close the VI or to choose another action/state machine

Acquisisci--> here I want to set the FREQ/SPAN/AMPT of the SA. If Freq is clicked all the other options are disabled and I want that the machine wait for a change of value before pass the SCPI code to the Visa Write.

So where is the error?  I hope that the explanation of the code is more or less clear and that you can give me an hand to figure out.

 

Download All
0 Kudos
Message 3 of 11
(3,208 Views)

Hi inu,

 

do you read my signature?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(3,201 Views)

About this: "- using more than one event structure in one VI might lead to problems"

 

I was thinking... how can you handle more events, as I need, without using more than 1 event structure?

 

Thank you again

0 Kudos
Message 5 of 11
(3,199 Views)

Hi inu,

 

you can handle events (more than one) with a single event structure in a state machine, sometimes combined with a Producer-Consumer-scheme...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(3,197 Views)

mmm ok but I continue to not see the visa error uff 😞

0 Kudos
Message 7 of 11
(3,194 Views)

Hi inu,

 

well, I can't open your VI as implied in message #4...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 11
(3,187 Views)

Wow.  That VI is a complete mess.

 

1.  You really shouldn't have more than 1 event structure.  The event structure can handle a ton of events.  You just have different cases for each event you want to handle (which I just noticed you already do for some of the structures).

2.  The way you are setting your state case makes no sense.  I'm really hoping that is just for debug purposes.  You should be wiring the shift register value to the case structure.

3.  You are not passing data out of all of your cases.  That is why your VISA reference is getting nullified.  The output tunnels are set to "Use Default if Unwired".  Since you didn't wire up the values, the default (NULL) will be passed on.  Change the setting of those tunnels and it will become quite obvious.


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 9 of 11
(3,172 Views)

Hi cross thank you for your reply:

 

1- well the problem is that I have for example 3 main events (FREQ/SPAN/AMPT) and a lot of sub-events to handle. I  tried to use at begin one event case but it didn't work.

 

2- if i do this, the driver will flow each case of the state machine. I want to give to the user a chance to choose in which state of the state machine he wants to be.

 

 

3- mmm I haven't understood this point... I completed all the VI now removing the unwired tunnels and the problems is still there. I have always the same error on the VISA. 😞

 

 EDIT: 3- Correct this point. I'm so sorry but I'm really tired and I miss some 😞 can you help me with the 1 and 2 points thank you cross

Download All
0 Kudos
Message 10 of 11
(3,168 Views)