LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I do Data Acquisition using Ethernet with CVI?

Hello,

 

I have never programmed an Ethernet interface before and I need information on how to do it using CVI.  My company creates electronics products that take input from various sensors.  I write GUI interfaces on a PC that connect with these products and allow users to do setups, graph data, etc.  I have been doing this over the serial port for years, but we are not adding an ethernet port to some of the products and I have to write a communications interface that will replace the serial interface we currently use. 

 

Specifically, what functions within CVI are appropriate for this?  I've heard of NI-VISA and regular VISA.  Is this functionality the one to use to do data acquisition via ethernet?

 

Thank you,

 

Judy Harrigan

0 Kudos
Message 1 of 13
(6,548 Views)

you said you were using the serial port. were you using the OpenCom, ComRd, ComWrt and CloseCom functions ? i mean, were you in control of the underlying communication protocol, or were you relying on a specific data acquisition library ?

also, what protocol will be used for transferring data over ethernet ? TCP ? UDP ? another lower level protocol ?

 

if you will be using standard TCP/IP communication, i will first suggest that you read some documentation on the net about TCP/IP and "socket programming". also, read the documentation of the TCP Support Library which comes bundled with CVI.

0 Kudos
Message 2 of 13
(6,531 Views)

Judy,

 

If you are writing programs that work with instruments that have both serial and Ethernet (and GPIB and USB for that matter) VISA is the way to go. NI-VISA is just NI's implementation of the VISA library.

0 Kudos
Message 3 of 13
(6,528 Views)

you said you were using the serial port. were you using the OpenCom, ComRd, ComWrt and CloseCom functions ? i mean, were you in control of the underlying communication protocol, or were you relying on a specific data acquisition library ?

also, what protocol will be used for transferring data over ethernet ? TCP ? UDP ? another lower level protocol ?

 

if you will be using standard TCP/IP communication, i will first suggest that you read some documentation on the net about TCP/IP and "socket programming". also, read the documentation of the TCP Support Library which comes bundled with CVI.

you said you were using the serial port. were you using the OpenCom, ComRd, ComWrt and CloseCom functions ? i mean, were you in control of the underlying communication protocol, or were you relying on a specific data acquisition library ?

also, what protocol will be used for transferring data over ethernet ? TCP ? UDP ? another lower level protocol ?

 

if you will be using standard TCP/IP communication, i will first suggest that you read some documentation on the net about TCP/IP and "socket programming". also, read the documentation of the TCP Support Library which comes bundled with CVI.

 

Hi,

 

First, I made a typo saying I'm NOT using ethernet when I meant to say we are NOW going to use ethernet.  Sorry if that was confusing.  Yes, I have been using the CVI comms functions you mention above to simply access the serial port and send/receive information using the standard Windows Input and Output Queues.  I am assuming at this point we will be using TCP/IP to get the data through and that it will be at a fairly high rate of transfer: 912.6 Kbps is what our unit will be clocking at this point, so any suggestions on how to get this on the PC side are more than welcome.  I will read up on the TCP Support Library.  Thanks for the info.

 

Judy

0 Kudos
Message 4 of 13
(6,525 Views)

If you are writing programs that work with instruments that have both serial and Ethernet (and GPIB and USB for that matter) VISA is the way to go. NI-VISA is just NI's implementation of the VISA library.

 

Thanks for the response.  I've been trying to find info on the VISA stuff through google, but I am getting credit card info interspersed in my search results Smiley Mad  It's a pain in the #$!. 

 

Judy Smiley Happy

0 Kudos
Message 5 of 13
(6,524 Views)

Hi again,

 

A quick question about VISA.  I'm reading the Spec put out by the IVI Foundation, but I need a little higher level information on this.  If I were to use the VISA spec to receive data over a TCP/IP connection using ethernet...

1.  Does the device need any specific VISA-related hardware or software to send the data through so that it is receivable by the VISA elements of my CVI application?

2.  Will I need to write a low-level driver on the PC side or is VISA essentially handling that and all I need to do is use the VISA functionality from my CVI application?

3.  When I have the communications up and running, does it matter if the data comes in via Ethernet or USB?  Can my application handle both with the same calls to the VISA functions?

 

Thanks in advance for any help.

 

Judy

0 Kudos
Message 6 of 13
(6,518 Views)

Hi Judy,

 

Thanks for your post.  Have you firmly decided to use TCP/IP communication, or might you still use NI-VISA?  I encourage you to check out some of the tutorials we have on Ethernet Instrument Control.  Please let me know if you have any trouble setting up your instrument.  Have a great day!

 

Regards,

 

Todd V. 

National Instruments
Applications Engineer
NI Prototyping Community
0 Kudos
Message 7 of 13
(6,517 Views)

Dear Todd_V,

 

may I join in by adding that in your list of recommended tutorials I miss a description of how to find, programmatically using CVI, all the instruments that are connected to my PC-Ethernet board. Lets assume that I have set up a private LAN using one of the private IP ranges, e.g. 192.168.x.x. Then how could one possibly find out the IPs of the instruments connected to this LAN? The idea is to have an automatic setup, and the first step, finding all the Ethernet addresses of the PC, is simple using the TCP library function GetAllTCPHostAddresses. But then, is there a chance to determine the IPs of the connected (and switched-on) instruments? Should one ping the 255x255 addresses and check for an answer? Or is there something smarter?

 

Thanks a lot,

 

Wolfgang

0 Kudos
Message 8 of 13
(6,508 Views)

Judy,

 

For Ethernet and serial you don't need to create any additional drivers to use VISA with your instrument. The VISA for that OS(Windows or Linux) will use native calls to winsock etc. Using VISA your program will work with either buses by just changing the resource string passed in to the viOpen function. e.g "tcpip::192,168.1.100::5025::socket" or "ASRL1::INSTR"

 

As Ethernet(raw socket) and serial are "serial" buses then you should enable the attribute termchar which informs VISA that you instrument is done send data back to the PC. Ethernet (VXI-11), GPIB and USB-TMC have mechanisms in their protocol to indicate to VISA when they are done transfering data from instrument to PC.

 

As you have LabWindows installed you should have NI-VISA installed also so refer to the NI-VISA help file which contains some message based examples in C and VB.

 

 

0 Kudos
Message 9 of 13
(6,459 Views)

the original poster told in one of his previous answer that he was using the standard communication functions. this makes me think that he is NOT already using VISA. as such he HAS TO write a VISA driver for his instrument...

 

i am not familiar with VISA, but from the documentation i have read, it seems the instruments have to support a specific protocol in order to communicate with VISA, specifically VXI-11. is it right ? this would mean that the people in charge of developping the sensor will have to implement the protocol for him to develop a software controlling them through VISA.

 

i am sorry, but i have to raise this warning: PAY ATTENTION TO THE PROTOCOL NEEDED IN ORDER TO USE AN EXISTING COMMUNICATION LIBRARY.

0 Kudos
Message 10 of 13
(6,452 Views)