LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Keithley RS232 Multiple Channels into array

Hello Community, 

 

I am in Sudan right now for my Master's Thesis and I am an Mechanical Engineer. I had not the slightest clue of Labview a week ago. I used a program that was given to me and did the work. It corresponded with the Keithley via the GPIB port. However the PC got stolen and the GPIB Card costs to much and cannot be obtained in Sudan. 

 

I use the Keithley 2700 MUltimeter and it scans 34 channels, mostly temperatures, some humidity sensors and pressure sensors. Everything is recorded in Volt.

Since the cheapest (and fastest) way is to replace the connection with a RS232 Serial Port, we did that. Within 3 days I managed to get the hardware recognized and the programm to start a scan on the Keithley 2700. I used some parts of code from the GPIB based code and checked some examples and some tutorials. The problem I have right now, is that the Scan starts, but in the Labview on the output windows nothing is seen. 

I store all channels in an array, because I have to correct/correlate them, to show temperatures/pressures/humidities. 

I know that the problem is either, that the time between the reads is too fast/too slow or something with the VISA read or VISA write is wrong. 

But since the problem works without an error I cannot figure out, what to change. 

 

below is the screenshot of the important part, and the complete .vi (however it is not complicated and very simple - I hope it is okay).

To sum up my problem: I want the programm to initialize the Keithley Scan (best would be when I press a Button, but havent tried to implement that yet), and store the Data of the 34 channels into an array to use it further.

 


 

Thank you for your help.

Philipp

0 Kudos
Message 1 of 14
(5,400 Views)

My advice would be to go to Keithley and download their LabView VI's and a couple of their example programs.

 

http://www.keithley.com/products/data/datalogger/?path=2700/Downloads

 

I took a quick look at their examples and while not the best LabView programming I have ever seen it should give you a good starting point to understand how to initialize and acquire data from the instrument.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 14
(5,384 Views)

@RTSLVU wrote:

My advice would be to go to Keithley and download their LabView VI's and a couple of their example programs.

 

http://www.keithley.com/products/data/datalogger/?path=2700/Downloads

 

I took a quick look at their examples and while not the best LabView programming I have ever seen it should give you a good starting point to understand how to initialize and acquire data from the instrument.


I kind of disagree with you.  Most, if not all of the original I/O code could be re-used.  I am assuming that the original code was written with the VISA drivers.  I believe the OP has configured the port correctly as well.  In fact, I think the only thing the OP needs to do is to look at the LV Serial port examples included in his LabVIEW installation...

One other thing - this directed at the OP - did you know that "Index array" is expandable by draging the lower edge of primitive?  You can drag it down for as many inputs as you need (in this case, 34).  If they are sequential - as yours are - you don't even need to specify the indices (or, if sequential but not starting at zero, you only need to supply the starting index).

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 14
(5,377 Views)

First of all, you indicators won't update until after the loop is completed.  That is because of data flow.  Nothing will go out of the while loop until it is complete.  I'm guessing that is your problem.

 

Now, let's try to simplify your code.

That loop and string manipulation you have to build up your array can just be done with a Spreadsheet String to Array function (it is in the string palette).

All of those Index Arrays are not needed.  First of all, the Index Array is expandable and it automatically increments inside for you.  So the first output will be X[0], second will be X[1], etc.  But those are not even needed.  LabVIEW can multiply and add arrays for you.  You just need to create arrays of your offsets and gains and multiply and add those with your data array.


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 4 of 14
(5,373 Views)

@crossrulz wrote:

First of all, you indicators won't update until after the loop is completed.  That is because of data flow.  Nothing will go out of the while loop until it is complete.  I'm guessing that is your problem.

 

Now, let's try to simplify your code.

That loop and string manipulation you have to build up your array can just be done with a Spreadsheet String to Array function (it is in the string palette).

All of those Index Arrays are not needed.  First of all, the Index Array is expandable and it automatically increments inside for you.  So the first output will be X[0], second will be X[1], etc.  But those are not even needed.  LabVIEW can multiply and add arrays for you.  You just need to create arrays of your offsets and gains and multiply and add those with your data array.


Nice going, Cross.  I couldn't for the life of me figure out what the stop button was for.  Now that you've rewritten the code, I can see that it is to stop acquisition.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 14
(5,368 Views)

I see that you are using the internal keihtly buffer but you proceed immediately to a VISA read.  You must first instruct the keithley that you are ready to receive information using the TRAC:DATA? command.  Note that when the device receives this command, info will be placed in the buffer for reading.  So you should ensure enough time has passed for each channel to be measured before sending Trac:DATA?

 

Your VISA read is waiting for a specific number of bits but is receiving none because you didn't tell the Keithley to provide information.  (I'm going off experience with a Keithley 2440 so these points should be valid for your device).

 

EDIT:  Stupid emotocons.... it's supposed to be colon followed by D.... not a stupid smiley face

Message 6 of 14
(5,367 Views)

Thank you pjr, 

 

I think this is exactely the missing part. I edited the Delphi-field by 

 

SLEEP(10000);
FORM:ELEM READ;
TRAC:DATA? 

 I hope it will work now. I don't know whether it will work. I will test it (the test site is located on the other side of the university)

Also thank you cross for shorten and simplify my code. Can you please explain what the offset and gain does (I guess it goes along the spreadsheet and created new boxes?

Also I can delete the DBL Measurements Box and just lead the array out of the while loop and slip the information again into 34 different pathes, right? 

Because each of the values stored in the array need another correction equation. 

I will test it, just asking in case what I coded isn't working. 

0 Kudos
Message 7 of 14
(5,316 Views)

I cannot edit.

 

But this still does not work. It makes the Keithley Multimeter read every x seconds, but it is not giving out the data of the array. And I do not know whether it is an error in the writing or in the reading progress of the buffer/array.

0 Kudos
Message 8 of 14
(5,309 Views)

The sleep command for the keithley is the wrong way to go, i think.  It would be better to have a wait in your labview code so the keithley can do it's measurements.

 

Another option, instead of an arbitrary wait. is to simply ask the meter if the buffer is full yet (make certain the buffer size is declared first).

 

Look at the Status Register Strucutre page of the manual (page 11-3 in my version).  We are going to utilize two registers to accomplish this.

 

STAT:Meas:Enab 512 will set the buffer full bit of the measurement event enable register.  When the buffer is full, 1 & 1 will set the MSB bit of the Status byte register.

 

Now, this, in combination with *SRE 0  will set the RQS bit.  This bit can be polled in a while loop using *STB? 

 

After the bit is set and this vi exits, reset the registers (Stat:Meas:Enab? will read and reset this register...)

 

So use commands STAT:MEAS:ENAB 512 and *SRE 0  before INIT... Then pole the register with *STB? ... Then read the data with TRAC:DATA?... Then reset registers.

0 Kudos
Message 9 of 14
(5,297 Views)

Okay, to be honest, I have no clue how to arrange those Delphi code. I know in which ordern, but not into how manz VISA write and reads.

 

As I mentioned above, I am an absolute beginner with Labview and Delphi. 

 

I took a screenshot of mz recent programm, but it doesn't work. If ou'd be so kind as to tell me how to correct it, that would be quite generous

0 Kudos
Message 10 of 14
(5,269 Views)