Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting Keithley 6517B via RS232-to-USB cable

Solved!
Go to solution

Hi all, 

I have been tried to connect the Keithley 6517B to PC using RS232-to-USB cable.

I would like to get continuous currents as a function of time from the 6517B. 

 

I set up the parameters of both 6517b and PC COM port are the same; RS232 mode, 9600 baud rate, CR, NONE flow control, RDG=y, RDG#=y, UNIT=y, 8 data bits, 1 stop bits. I also tried several COM ports from 1 to 4.

 

This is my cable and RS232 extension: Ugreen RS232-to-USB (https://www.ugreen.com.cn/products/usb-2-0-to-rs232-serial-cable?variant=15398911737901)

Cable extension: iCan RS232 straight-through extension cable (https://www.canadacomputers.com/product_info.php?cPath=5_1340_1418_1450&item_id=005367)

 

I got a 6517b for RS232 example (RS232_6517BtracedataRS232_example 1.vi, attached), but the timeout expired error appeared at VISA Read. Before reading the data, the 6517B works well. (e.g., voltage set 1.0V, changed the mode as current measurement, and others).

 

Here are the error code and diagram for mine
Possible reason(s): VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

Steven_H_0-1576868365806.png

 

I also got another example of 6517B for RS232 (RS232_6517BRS232_example 2.vi, attached). it indicated the same error as above. 

Possible reason(s): VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

 

Steven_H_1-1576868783966.png

 

IDN*? or other simple SCPI based commands work well, but I think only VISA Read part is not working. 

 

It would be appreciated if you could advise me.

Is the cable (RS232-to-USB) issue?, the LabView programming issue?, or the parameter (baud rate, CR, or others) issue?

 

If the cable issue, we also consider the purchase of the Prologix GPIB-to-USB adapter. 

 

Happy holiday and I hope you all the best. Thank you.

0 Kudos
Message 1 of 11
(6,878 Views)

You are sending the INIT command and then immediately asking for the trace.  You need to wait for all the points in your measurement to be measured before you can request the data.  There are a few ways you could do this; time delay, *OPC?, *WAI, SRQs. 

 

The later three are preferable the first will work if this is just a quick one time data collection need - send init, wait NNNs for measurement to complete, read back data.  

 

Craig

Message 2 of 11
(6,830 Views)

Hi Craig, 

Thanks for letting me know the information.
Did you mean that I have to use some commands like "*OPC?, *WAI, SRQs" for delaying the reading the data?

If I'm right, I will try to do it as soon as possible. Thank you. 

Regards,

Steven

0 Kudos
Message 3 of 11
(6,797 Views)

You could just set a longer timeout and wait.  But read this to better understand synchronizing instrument requests.. https://www.ni.com/en/support/documentation/supplemental/06/using-instrument-status-registers-and-se...

 

RS232_6517BRS232_example2_CDS.png

 

 

Message 4 of 11
(5,818 Views)

Hi Craig, 

Thanks for your considerations. I will read it.

If you don't mind, could you upload the vi as the 2018 version?

I couldn't test the uploaded file.

 

Thanks again, happy new year!

 

 

0 Kudos
Message 5 of 11
(5,802 Views)

Hi Craig, 

I mimicked your vi with "VISA Set Timeout" function. 

However, the timeout expired error appeared without reading the buffer after the time, what I set as the timeout as 20,000 (in your example 2,000,000). 

 

Steven_H_0-1577918008522.png

 

The measurements had been done before the timeout (20,000). I set to measure the point per every second for 10 secs, but ":TRACE:DATA?" didn't read the buffer from the equipment.  

 

I think the problem is ":READ?" and ":TRACE:DATA?" these parts. the instruments didn't get back the data. 

 

for the example 1 case (:TRACE:DATA?), it couldn't read from the buffer. it just indicated "" on reading buffer part.

for the example 2 case (:READ?), it could read once, but the error appeared.

 

It would be appreciated if you could give me other advice for me. Thank you.

 

0 Kudos
Message 6 of 11
(5,772 Views)
Solution
Accepted by topic author Steven_H

In your code you need to set the timeout before you send the :INIT; command.  That command starts the measurement and the wait is only 1000ms, but then you immediately ask for data which will cause the timeout. 

 

In your original code you used a Line Feed, now you are using a CR as termination. Are you 100% certain you need either?  VISA should handle that for you.  You might be appending a second termination character.

 

Also the 6517B has a nice LabVIEW driver you could use...

http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=2C23A2069DC43544E05490E2BA35FC...

 

Craig

 

Message 7 of 11
(5,739 Views)

Sorry for the late reply. I have to finish some works first.

I know the 6517b has the NI driver, but this for GPIB... (recently, I ordered a gpib-to-usb cable to use this driver).

 

Now, I recognized that I should have used time delay before using the reading commands (e.g., :READ? or :TRACE:DATA?). I understood that's the reason why I couldn't get a real-time reading response from the equipment. Actually, I would like to do that. 

 

However, even if I increased the timeout, I couldn't read the data. Still, I don't know how to solve/design for measuring/reading the data from equipment simultaneously or at once. Thus, I made two vi files, and it worked (one for control, and the other for reading). 

 

Steven_H_1-1578448583639.png

 

I know that it is very stupid, but I don't have any ideas about how to simplify them. Now, I'm just about to use two files, or I will wait for receiving the gpib-to-usb cable to use NI driver...

 

If you have any advice for me, It would be appreciated. Thank you!

0 Kudos
Message 8 of 11
(5,628 Views)

This is never going to be a real-time system, an Electrometer is not a high speed streaming type instrument. Integration times can be very long..some of mine are 1-2mins/pt.

 

You might want to review exactly what the :READ? and :TRACE:DATA? commands do as I don't think they are identical.  Generally :READ? initiates a trace, then returns that new measured data. I'm not sure what :TRACE:DATA? does, but it might just be returning what is currently stored in memory and could be nothing at all.  RTM.

 

You should look at the NI driver and how they sequence commands to accomplish measurements and data processing.    It might work with RS232, I don't see why not except there might be som VIs that use GPIB bus specific *OPC/*WAI commands but those could be avoided easily enough.  At the very least look at how they do the data parsing, it will make your life easier.

 

Craig

0 Kudos
Message 9 of 11
(5,610 Views)

I think that :TRACE:DATA? is used for 6521 which is a scanning card (10 channels max) to be inserted on the rear panel of 6517B.

 

0 Kudos
Message 10 of 11
(5,017 Views)