03-09-2010 09:49 PM
Hi, All,
I have a question when I wanna use GPIB write function. I am not clear about what those modes meaning like EOI, CR or LF in the help.
0 | Send EOI with the last character of the string. |
1 | Append CR to the string and send EOI with CR. |
2 | Append LF to the string and send EOI with LF. |
3 | Append CR LF to the string and send EOI with LF. |
4 | Append CR to the string but do not send EOI. |
5 | Append LF to the string but do not send EOI. |
6 | Append CR LF to the string but do not send EOI. |
7 | Do not send EOI. |
In fact, I wanna increase voltage supply by 5V every 5s. I wrote a program in the attached files. Pls help me to see if it is logical.
Thanks.
Solved! Go to Solution.
03-09-2010 10:21 PM
The mode has to do with how a GPIB write is terminated. The standard for quite a few years has been to assert the EOI (End or Identify) management line when the last data byte has been sent. The other modes are there to support old instruments before the current standard was adopted. Some of them required a CR (carriage return), LF (line feed), both, etc. Your instrument manual should explain what, if any additional termination is required. The current standard was adopted in 1987 so your instrument would have to older than you is my guess if you need those special modes.
Your VI should work okay with the addition of the wait and wiring up the N terminal of the for loop but is not the most elegant. First, instead of the GPIB primitives, you should use the VISA functions. Instead of wiring the iteration terminal, you can use a shift register and a add function with an increment. You can use a while loop and stop it when it reaches a final value. Instead of the concantanate string function, I prefer to use the Format Into String function.
If you keep this code, get rid of the second GPIB address string control. Thetimeout function of the GPIB write is not related to a trigger and you can leave it unwired and just use the default.
03-10-2010 10:06 AM
Hi,
Thanks for your help. But I wanna make sure what my understanding is right.
1. For mode choice, I think I need to choose 0 mode by using the last character of the string; Is it necessary to wire this mode or I can leave it unwired?
2. Why VISA is better than GPIB write?
3. Why register shift is better than interation?
4. Why while loop is better than for loop?
5. For timeout, does it work as a waiting time? My purpose is to control the voltage increase after a certain while. Here in for loop I wanna increase voltage and keep it for a while before entering next loop. Does it work with our program?
Thanks.
03-10-2010 10:41 AM
It really does not matter what you think. You need to read the manual and see what it says to use for a termination character, if any. As I said, for modern instruments, all you need is EOI. It is not using the last character of the string. It is using the management line called EOI. Leave it as the default. You should be doing all of your testing in MAX, anyway instead of jumping right in and writing some code.
VISA is portable. You can use VISA for GPIB, RS232, USB, and Ethernet communications. You can use VISA with NI controllers and controllers from other vendors if they provide a VISA driver for their card. The overhead is minimal.
I happen to think the while loop with a start, increment, and stop is more flexible. You have to hard code the iteration count after manually calculating it. Do whatever you want.
No, read the help for the timeout. It has nothing to do with waiting time except how it is described in the help.
Instead of trying to write your own code for the instrument, why don't you use the driver? Or do you like reinventing the wheel.