07-11-2013 12:20 AM
Hi all,
I am porting the labview vi to CVI. I have an external device which is connecting to the computer with GPIB and in the labview, I use VISA WRITE (the icon contains VISA abc) to send the command to control the external device. In the CVI, I didn't find any example about VISA, so what command should be used to replace VISA abc WRITE in labview vi code? How do I specified the device address? I appreciate it if there is any example for reference.
07-11-2013 12:41 AM
In CVI, you will find the VISA commands via the menu Library / VISA (provided you have VISA installed). A brief introduction can be found here
The first command probably will be to open the resource manager
status = viOpenDefaultRM ( &resource_manager_handle )
then to open the port
status = viOpen ( resource_manager_handle, port_descriptor, VI_EXCLUSIVE_LOCK, timeoutvalue, &session_handle );
A typical write command looks like
status = viWrite ( session_handle, buffer, count, return_count )
Hope this will help getting you started.
07-11-2013 12:23 PM
@Wolfgang wrote:
In CVI, you will find the VISA commands via the menu Library / VISA (provided you have VISA installed). A brief introduction can be found here
The first command probably will be to open the resource manager
status = viOpenDefaultRM ( &resource_manager_handle )
then to open the port
status = viOpen ( resource_manager_handle, port_descriptor, VI_EXCLUSIVE_LOCK, timeoutvalue, &session_handle );
A typical write command looks like
status = viWrite ( session_handle, buffer, count, return_count )
Hope this will help getting you started.
Thanks. But I don't know how to create the resource_manager_handle, is there any example to show how to use that? In the labview code, I only have to specify the address like GBIP0:xxx:yyyy 😞
07-11-2013 02:39 PM
You create the resource_manager_handle the way I told you, by calling viOpenDefaultRM ( &resource_manager_handle )
If you are looking for explanations and examples, the help manual may be useful, too.
07-11-2013 07:07 PM
@Wolfgang wrote:
You create the resource_manager_handle the way I told you, by calling viOpenDefaultRM ( &resource_manager_handle )
If you are looking for explanations and examples, the help manual may be useful, too.
oh, so you mean &resource_manager_handle is the handle returned by viOpenDefaultRM? I thought I have to create that first and pass that to the function. Sorry, I didn't understand the meaning of '&' before I read this reply. I just google it 😉
07-11-2013 11:30 PM
Well, CVI is an integrated environment of libraries, editor, etc. but the C in CVI means that it is based on the language C
So instead of googling for the ampersand you may read a book about C... in the long term it will not work without it
One (of several) internet sites about C is http://www2.its.strath.ac.uk/courses/c/