09-09-2013 04:00 AM - edited 09-09-2013 04:01 AM
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:
09-09-2013 04:16 AM
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"!
09-09-2013 04:35 AM
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.
09-09-2013 04:39 AM
09-09-2013 04:45 AM
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
09-09-2013 04:47 AM
09-09-2013 04:51 AM
mmm ok but I continue to not see the visa error uff 😞
09-09-2013 04:52 AM
09-09-2013 07:11 AM
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.
09-09-2013 07:25 AM - edited 09-09-2013 07:45 AM
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