LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

rs 232 device data reading limits keithley 2400 IV with labwindows

Hey Folks, I'm using labwindows/CVI to communicate with Keithley 2400 Voltage Current Source meter, to make digital curve traces. I am using RS-232. I can successfully initiate a serial COM and send the data set to the Keithley, I can also successfully read back the results but here is the catch, I can only read back up to 2000 data points, once it hits 2000 results it freezes up. I'm not sure if this is an issue with Labwindows or RS-232 Communication or the Keithley 2400, I looked through the entire 2400 manual but see nothing about a limitation on data points.

 

The serial setting I'm using are:  9600 baud/ odd parity / 8 data bits / 1 stop bit / cts off / xon-xoff enabled / 5sec timeout / 512 input queue / 512 output queue.

 

Below is a snippet of code I use to read the data back, I am sure there are more specifics that you all might need so I will be happy to give more details.

 

Thanks for your time and any help! Smiley Happy 

 

 

for(i=0;i<=num;i++){
        read_data[0] = '\0';
        buf[0] = '\0';
        bytes_read = ComRdTerm (comport, read_data, 70, 13);
          p = strtok (read_data," ,");
        if(p != NULL){           
            n=sprintf(buf,"%s",p);
            results[i].param1 = atof(buf);
            p = strtok (NULL, " ,");
            buf[0]='\0';
            n=sprintf(buf,"%s",p);
            results[i].param2 = atof(buf);
        }

}

Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
0 Kudos
Message 1 of 25
(6,474 Views)

Hi dsappet,

When you say that it freezes up, do you mean that the Keithley device freezes up or your computer freezes up?  Or is just the exe you created in CVI freezing up? 

 

If it's the Keithley freezing up, how big are the data sets that you're sending data sets to the Keithley?  Are there limitations on how big the data sets can be that you're sending to it?  


Mark E.
National Instruments

0 Kudos
Message 2 of 25
(6,436 Views)
The keithley doesn't freeze it is the program, i send a commands to set up a step function, so i will say (for example) go from -10V to 10V in .1mV steps or something like that. The Keithley goes through that entire function, then the computer starts reading back the results, i made a small widgit to write an int to the GUI for every measurement read back from the keithley, and it happily goes 1,2,3, ... all the way to 2000, once it hits 2000 the program freezes, the keithley already has taken the data and stored it and the PC is just reading it back. Hopefully this answers your question, let me know if I missed! Thanks!
Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
0 Kudos
Message 3 of 25
(6,434 Views)

Hi Douglas,

 

I suspect that the lock-up is not related to rs-232 calls.

If it is, it may be related to xon-xoff.

I have no experience with it, but I did not understand what you need it for?

 

Are you sure your reader loop does not fail to exit?

Maybe you end up with an infinite loop that freezes the GUI.

 

Can you debug your code and identify which function failse to return, so that the code freezes?

You can put a conditional breakpoint, so that you do not have to press F10 many thousand times.

 

Hope this helps, 

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 25
(6,415 Views)

thanks for your continued help on this, so it is definatly not stuck in the loop i will make steps so that num is 3000 or something it gets stuck on the bytes_read = ComRdTerm (comport, read_data, 70, 13); at i=2000 i have tried with the xon-off thing enabled and disabled. As far as I know it adds something to know when the buffer is full so it won't loose data, i thought maybe that was happening so I enabled it but to no benifit. So it seems to be failing the ComRdTerm function as if there is a problem talking with the com port. IF there was no data from the device it should just return null and I have conditions for that but its as if the com port became disabled or something. 

 

Thanks again

Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
0 Kudos
Message 5 of 25
(6,410 Views)

It stops when it gets to exactly 2000? Every time? That seems to be a suspiciously human-related number. How many elements have you specified for your array of results structures?

 

JR

0 Kudos
Message 6 of 25
(6,409 Views)
That was one of my first thoughts but my array is 6000 elements, it did seem very odd that it was always 2000 although sometimes it will get to 2200 another very nice even number. But there is not a randomness like a different number around 2000 every time, it is very consistant and a nice even number. Also it doesn't fail when setting the array value, it hangs on the comread function.
Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
0 Kudos
Message 7 of 25
(6,410 Views)

Are you using a USB-Serial converter? A few years ago we had a similar issue, where a serial input stream into a laptop USB via a converter would suddenly stop for no apparant reason, after several thousand bytes were read by a CVI program. The convertor had been borrowed, and when we replaced it with our own (a different make, with different drivers) we had no more problems.

 

About how many bytes would you say corresponds to your 2000 lines? Anywhere near 32767?

 

JR

0 Kudos
Message 8 of 25
(6,407 Views)

Hi again, I am not using a usb-serial converter it is a motherboard serial port on a dell pc. I am not sure how many bytes this cooresponds too I will have to do a little digging to figure it out. I think it is two doubles per data point but I will have to double check if they are doubles (no pun intended) lol

 

Thanks,

Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
0 Kudos
Message 9 of 25
(6,405 Views)

There is no condition that would normally make ComRdTerm wait forever.

If it is waiting for the bytes to arrive (when they are not) then it should timeout and return.

 

Can you make the for loop like this and try again:

 

for (i=0; i<num; i++)  instead of  for (i=0; i<=num; i++) 

S. Eren BALCI
IMESTEK
0 Kudos
Message 10 of 25
(6,402 Views)