LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean button control and GPIB communication



Looking at what you are doing, you are directly concatenating the strings and writing to gpib, i wonder if you are writing it correctly. check the syntax for the instrument. as you concatenate.
 

 



Hi Dravi99 :
 
Sorry about that, I am a rookie. So perphas I made lots of ridculous mistakes.
 
Actually, What I want to do is implement a boolean control for imputting the commands to GPIB. "normal writing or query"
Then I can implement the automatical sampling from the Agilent analyzer.
 
such like :  At per 10min,  the command 1 (eg: calculate1:data?) will be triggered and inputted to the Agilent analyzer. After the datas from 1 channel are sampled, then the command2 is triggered automatically.
 
Now my problem is:   when I maunally input the command by string input box,  communication is ok. but when I use boolean buttons, it doesn't work. (whatever writing or query)
 
Do you have any other good idea about it.  you know, maybe using "concatenating the strings and writing to gpib"  seems silly.
 
Thanks again and I really apreciate your help
 
Wei
 
0 Kudos
Message 11 of 17
(1,141 Views)
At some point, you should also make the following modification. With this change, you don't have to make sure that one of the Booleans is always true.
0 Kudos
Message 12 of 17
(1,137 Views)
Hi Dennis:
 
At the 2nd example:  
 
(command1: calculate1:data,  command2: calculate1:data.  these are just random string )
 
1. I run the vi based on the continuously mode.
2. I make the command1 button true, no response in the string indicator.
3. I make the command1 false, and make the command2 true, still no response.
 
---------------------------------
or if I run the vi fllowing below steps
 
1. Make the command1 button true
2. Run the vi based on the continuously mode, then the Agilent analyzer get that string, communication is ok.
3. Make the command1 flase,  it is ok, command1 is stop.
4. Make the command2 true, no response, make the command2 false, no response
5. Make the command1 true, no response, the program is dead.
 
-------------------------------------------------------------------
At the 1st example vi, named wei.vi
(command1: calculate1:data?,  command2?: calculate1:data.  these are real query command of Agilent analyzer)
 
If I wired the connection like 2nd example(directly connect the output of "Concatenate Strings"), the results are similar with 2nd example. Based on the continuously mode, the program doesn't work.
 
**But if I didn't wire that connection, just manually input the commands by normal string input box, everthing is fine.
 
-----------------------------------------------------------------------
 
Thanks for your suggestion for implementing GPIB communication by VISA. but I have a question
 
GPIB interface number : 0
Primary address:  11
second address :  None
 
So the VISA resource name that I should set is  GPIB0::11:INSTR ,   right???
But when I use the special driver for Agilent 35670A that I download from the link you give.   It doesn't work, 
the error message is :  -1073807202, VISA Write in Agilent 35670.lvlib:Data Coord Trans Data.vi
 
sorry to bother you so long time, thanks so much
 
Wei
 
 
0 Kudos
Message 13 of 17
(1,132 Views)

DO NOT RUN YOUR VI IN CONTINUOUS MODE!

As I stated earlier, that would be silly. Continuous mode should only be used in certain debug situations and your VI will have numerous problems. As you switch the buttons, you have the possibility of sending either an empty string and then trying to do a read or you might actually send both strings and then do a read. Both are guaranteed to cause a problem. When you have a constant, there is no possibility of sending something incorrectly with each iteration. If you have been doing this all along, that's probably the cause of all your problems. If you do exactly as I said and just click the run button, it should work. If there is a reason that you need to send the command over and over again, then you should be putting a while loop around the GPIB Write and Read.

The error you get indicates you do not have NI-VISA installed.

0 Kudos
Message 14 of 17
(1,131 Views)


Dennis Knutson wrote:
At some point, you should also make the following modification. With this change, you don't have to make sure that one of the Booleans is always true.


Hi Dennis:

It seems very weird. the modification example you give me is ok.

you know, when I switch the command1 to command2, it works. But how can I stop it.

why if I use 1st command at case' true', and  2nd command at case' false', it works.

But if I use 1st command at case' true', and "no command" at case' false '  it does not work.  you know, like the original example I give you.

Thanks for you help

 

Wei

 

0 Kudos
Message 15 of 17
(1,129 Views)

Hi Dennis:

Thanks for your explaination with such endurance.

Yes, you are right, I am really sorry I misunderstanding your means before.

step running is actually no problem.  But I wonder if I want to implement real-time data sampling from Agilent analyzer, how should I do?  (Generating a loop in my program?   a infite loop looks same with the continuously running?), you know,  I have to continuously send a  command to sample the data.

 

0 Kudos
Message 16 of 17
(1,119 Views)
If you want to run a continuous query, then a while loop with a front panel Boolean to stop the while loop is the way to go. I'm not quite sure if you want to continuously run the command for calc1, calc2, or alternate. If you want to alternate, they you probably want to do something different with your chart so that you can display each result on a separate plot and log it the same way. Attached is a simple mod that does the two separate commands and display each result in a different plot.
0 Kudos
Message 17 of 17
(1,113 Views)