Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data from external pc

Solved!
Go to solution

Hi guys, I'm kinda new to the NI instruments, and I need to figure out how to read data from a PXI-1042Q, which has a PXI-8187 as an embedded controller, and an array of PXI-4472. I need to read the data from an external computer via one of the serial ports of the PXI-8187 using a home-made program in python. I've found something on how to send and retrieve data from a serial port using pyVisa, still I don't know how to communicate with the PXI-8187 and how to select the proper input from the PXI-4472. Do I need to create a custom VI on the PXI-8187 to make it listen for inputs via serial and to send the output data to the same port? Any suggestion will be appreciated.

 

Thanks in advance!

0 Kudos
Message 1 of 7
(5,200 Views)

You need to create a program that goes into the embedded controller.  That controller needs to do all of the data acquisition, any other processing you want it to do, and then send it out of the serial port.  The format you use to send the data through the serial port is completely up to you.

 

What language did you plan to use in the controller?  LabVIEW?  C++/C#?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 7
(5,192 Views)

I think I'll use LabVIEW in the controller, even if I need to figure out how to pass the "start acquiring" and then pass the results out to serial. For the moment, using LabVIEW, I'm able to read an accelerometer, and graph the results. But I guess it will be easier than I actually think 😄

What I'm trying to achieve is:

1) Use a python script to setup the test (done)

2) Trigger an impactor with python (done)

3) Tell the instrument to start collecting data from the accelerometer via a serial port

4) Collect the data and send the results back to the python script

5) Store the returned data

6) Repeat steps 2-5 a variable number of times.

 

I tried to achieve the whole process even using Visa remote server, but I think there is a mismatch between the visa version of the embedded controller and my computer, since I cannot send any query to the instrument. I then guessed serial communication would probably be easier to configure and run.

 

Any suggestion on how to achieve steps 3-5? I'm using pyVisa to communicate via serial with the instrument, and I'll try as soon as I can to create a VI in LabVIEW to send and receive data via serial (I'm currently using the instrument at the university, so I cannot work with it for long.)

 

Really many thanks for the support, and thanks in advance for any other suggestion or reply.

0 Kudos
Message 3 of 7
(5,185 Views)
The 4472 is programmed with DAQmx and not VISA so the remote server will not see it. Why use the serial port instead of a lan connection?
0 Kudos
Message 4 of 7
(5,171 Views)

Actually there is no reason, I just thought it would be better 😄
I've found pyDAQmx, so I suppose I could use this one instead of pyVisa for reading data from the 4472. Still I need to figure out how to communicate with the embedded controller (PXI-8187) from my computer. I suppose using the lan interface will be a viable choice, do I still need to create a VI to interface the PXI-8187 with my computer via lan?

0 Kudos
Message 5 of 7
(5,168 Views)
Solution
Accepted by topic author DocShadow

@DocShadow wrote:

 do I still need to create a VI to interface the PXI-8187 with my computer via lan?


Yes.  The controller is another computer.  Treat it as one.  That computer must interface with the PXI instruments.  Your computer that you are writing the Python scripts for has no interaction except through whatever interface you create, whether it is serial or LAN (I recommend using LAN as well).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 7
(5,165 Views)

I've done it! (or at least so it seems...)

I've created a VI tcp interface which listen to a connection, listen for a command and send the data acquired back. The listening/sending is enclosed in a while loop, and it checks for a specific string to exit the loop. The python side is a simple socket connection to the VI server, which reads/sends the data from/to the server.
Last thing to do is to figure out the data type acquired from the daq, but I guess this is a nice step forward!

 

Thanks to everyone for the suggestions and hints!

 

Best regards,
Lorenzo.

0 Kudos
Message 7 of 7
(5,148 Views)