11-24-2009 12:48 PM
Hello,
I was hoping someone could help me. This is my first posting and the first time I have programmed in Labview. I apologize if I am overlooking something simple. The manuals have gotten me this far, but now I am stuck.
I wrote a program to record voltage (Keithley 2400-GPIB-address 26) and two temperature readings (J-KEM Gemini has 2 thermocouples - Serial RS232 - Addresses 24 and 25). The program works fine when I record the voltage and 1 temperature, but times out when I try to add the second temperature (I used a random number generator for the second temperature to confirm that the rest of the program was working). The program times out when I use the Instrument Assistant to capture the second temperature.
"Error -1073807339 occurred at VISA Read in Instance 17 19SeebeckMeasurements .vi->SeebeckMeasurements.vi
Possible reason(s):
VISA: (Hex 0xBFFF0015) Timeout expired before operation completed."
Attached is my program and the NISpy file. The manufacturer of the J-KEM temperature controller does not offer a device driver but gave me the following command to record temperature: "T(address)/r ". I am using the default settings of 18N1 and 9600 baud. I have the 3 Instrument Assistants set to time out after 3000 ms and I would like to record data every 200 ms
Up to this point the NI manuals have been an excellent resource. I was hoping someone from the Forum can help me get over this hump. Thanks so much.
Dave
1. VISA Set Attribute ("GPIB0::26::INSTR", TMO_VALUE, 3000)
Process ID: 0x00000C98 Thread ID: 0x00000F34
Start Time: 13:25:24.901 Call Duration: 00:00:00.015
Status: 0 (VI_SUCCESS)
2. VISA Set Attribute ("COM1", TMO_VALUE, 3000)
Process ID: 0x00000C98 Thread ID: 0x00000BF0
Start Time: 13:37:58.191 Call Duration: 00:00:00.016
Status: 0 (VI_SUCCESS)
3. VISA Set Attribute ("COM1", TMO_VALUE, 3000)
Process ID: 0x00000C98 Thread ID: 0x000000F0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
4. VISA Set Attribute ("COM1", TERMCHAR, 13)
Process ID: 0x00000C98 Thread ID: 0x000000F0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
5. VISA Set Attribute ("COM1", TERMCHAR_EN, 1)
Process ID: 0x00000C98 Thread ID: 0x000000F0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
6. VISA Set Attribute ("COM1", TERMCHAR, 13)
Process ID: 0x00000C98 Thread ID: 0x00000BF0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
7. VISA Set Attribute ("COM1", TERMCHAR_EN, 1)
Process ID: 0x00000C98 Thread ID: 0x00000BF0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
8. VISA Set Attribute ("GPIB0::26::INSTR", TERMCHAR, 0)
Process ID: 0x00000C98 Thread ID: 0x00000F34
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
9. VISA Set Attribute ("COM1", ASRL_END_IN, 2)
Process ID: 0x00000C98 Thread ID: 0x000000F0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
10. VISA Write ("COM1", "T(25).")
Process ID: 0x00000C98 Thread ID: 0x000000F0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
11. VISA Set Attribute ("COM1", ASRL_END_IN, 2)
Process ID: 0x00000C98 Thread ID: 0x00000BF0
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
12. VISA Set Attribute ("GPIB0::26::INSTR", TERMCHAR_EN, 0)
Process ID: 0x00000C98 Thread ID: 0x00000F34
Start Time: 13:37:58.207 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
13. VISA Write ("COM1", "T(24).")
Process ID: 0x00000C98 Thread ID: 0x00000BF0
Start Time: 13:37:58.207 Call Duration: 00:00:00.015
Status: 0 (VI_SUCCESS)
14. VISA Write ("GPIB0::26::INSTR", "READ?")
Process ID: 0x00000C98 Thread ID: 0x00000F34
Start Time: 13:37:58.207 Call Duration: 00:00:00.015
Status: 0 (VI_SUCCESS)
15. VISA Read ("GPIB0::26::INSTR", 4096, "-4.509825E-04,+9.9100...")
Process ID: 0x00000C98 Thread ID: 0x00000F34
Start Time: 13:37:58.222 Call Duration: 00:00:00.063
Status: 0 (VI_SUCCESS)
16. VISA Read ("COM1", 4096, "21.9.")
Process ID: 0x00000C98 Thread ID: 0x000000F0
Start Time: 13:37:58.222 Call Duration: 00:00:00.078
Status: 0 (VI_SUCCESS)
> 17. VISA Read ("COM1", 4096)
> Process ID: 0x00000C98 Thread ID: 0x00000F34
> Start Time: 13:37:58.300 Call Duration: 00:00:02.996
> Status: 0xBFFF0015 (VI_ERROR_TMO)
11-24-2009 03:18 PM
11-25-2009 08:15 AM
Thanks for the advice. I changed the program so that there is only one Instrument Assistant for the two thermocouples (J-KEM Gemini) connected to the RS232 port. I also tried connecting the error in and the error out but that didn't seem to help.
Attached is a much simpler version of the program with the temperature readings only, and the new NI Spy file. The program will cycle through about 1-10 times and then I get the same timed out error message.
Any additional suggestions would be greatly appreciated. Thanks again.
Dave
11-30-2009 11:37 AM
Here is a very simple program to display temperature (Eventually I want to record the 2 temperatures, but I want to get this error fixed first). The program will loop through about 1-10 times and then I get a timeout error. Sometimes the program will run and display temperatures for almost a minute before it times out.
The hardware is a J-KEM Gemini temperature controller (two thermocouples). Does anyone have any ideas on how to fix this? The settings are 18N1 9600 baud. I tried connecting the error in and error out and I tried changing the timeout value in the instrument assistant. The program is really simple, so it should be easy to follow.
Thanks,
Dave01
NISpy:
1. VISA Set Attribute ("COM1", TMO_VALUE, 4000)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:33.983 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
2. VISA Set Attribute ("COM1", TERMCHAR, 13)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:33.983 Call Duration: 00:00:00.015
Status: 0 (VI_SUCCESS)
3. VISA Set Attribute ("COM1", TERMCHAR_EN, 1)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:33.998 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
4. VISA Set Attribute ("COM1", ASRL_END_IN, 2)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:33.998 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
5. VISA Write ("COM1", "T(24).")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:33.998 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
6. VISA Read ("COM1", 4096, "26.9.")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:33.998 Call Duration: 00:00:00.078
Status: 0 (VI_SUCCESS)
7. VISA Write ("COM1", "T(25).")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:34.076 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
8. VISA Read ("COM1", 4096, "26.5.")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:34.076 Call Duration: 00:00:00.078
Status: 0 (VI_SUCCESS)
9. VISA Set Attribute ("COM1", TMO_VALUE, 4000)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.822 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
10. VISA Set Attribute ("COM1", TERMCHAR, 13)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.822 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
11. VISA Set Attribute ("COM1", TERMCHAR_EN, 1)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.822 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
12. VISA Set Attribute ("COM1", ASRL_END_IN, 2)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.822 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
13. VISA Write ("COM1", "T(24).")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.822 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
14. VISA Read ("COM1", 4096, "26.7.")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.822 Call Duration: 00:00:00.078
Status: 0 (VI_SUCCESS)
15. VISA Write ("COM1", "T(25).")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.900 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
16. VISA Read ("COM1", 4096, "26.3.")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:35.900 Call Duration: 00:00:00.062
Status: 0 (VI_SUCCESS)
17. VISA Set Attribute ("COM1", TMO_VALUE, 4000)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.809 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
18. VISA Set Attribute ("COM1", TERMCHAR, 13)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.809 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
19. VISA Set Attribute ("COM1", TERMCHAR_EN, 1)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.809 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
20. VISA Set Attribute ("COM1", ASRL_END_IN, 2)
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.809 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
21. VISA Write ("COM1", "T(24).")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.809 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
22. VISA Read ("COM1", 4096, "26.5.")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.809 Call Duration: 00:00:00.078
Status: 0 (VI_SUCCESS)
23. VISA Write ("COM1", "T(25).")
Process ID: 0x000008B8 Thread ID: 0x00000D58
Start Time: 12:10:40.887 Call Duration: 00:00:00.000
Status: 0 (VI_SUCCESS)
> 24. VISA Read ("COM1", 4096)
> Process ID: 0x000008B8 Thread ID: 0x00000D58
> Start Time: 12:10:40.887 Call Duration: 00:00:03.990
> Status: 0xBFFF0015 (VI_ERROR_TMO)
11-30-2009 01:40 PM
Hi Dave and others,
I have a similar problem, I use a Keithley 2700 series, and sometimes it will time out and will hang after that. My problem seems to be related to missing termination characters, it seems like the NI-visa drivers are sometimes just `forgetting' to add the termination char for no apparent reason. I haven't figured out exactly why the term chars are sometimes left out though (sometimes I have an hour of heavy communication before it occurs, and then it happens after just 3 commands), so ideas are welcome on that part...
Anyway, you might want to monitor your COM port with an external program so you can see the serial traffic directly (I don't trust NI-spy on this one since I suspect the problem might be in the VISA drivers). I use http://www.serial-port-monitor.com/free-serial-port-monitor-product-details.html, but there's plenty of other programs out there capable of doing just that. Sorry, it's not the complete solution you would probably rather have, but it might point you in the right direction.
Cheers,
Klomp
12-01-2009 07:57 AM
Hello Dave,
If you would like to constantly monitor the temperature in a loop, than you should only initialize the COM port at the beginning of your application, and then only do the Read/Writes in the loop. Once you have exited the loop, you should close the reference to the COM port.
The Instrument I/O Assistant should allow you to generate the VISA code and then customize it if required. If increasing the VISA timeout value does not help, you have the option of catching the timeout error and doing another read.
Hello Klompmans,
I invite you to isolate the timeout problem with the Keithley 2700 series down to as few VIs as possible, and then start a new Thread about the issue. You could also consider trying another instrument control bus and seeing if the issue still occurs at the same frequency.
Cheers,
NathanT
12-01-2009 10:01 AM
Help » Find Examples » Hardware Input and Output » Serial » Basic Serial Write and Read.vi
Klomp - This might be a useful tool to help you with your Keithley issue. My timeout error (similar to yours) seems to happen when there are 0 bytes to read. Since you seem to have the same issue, I'll let you know if I come across anything else that might help us.
Nathan - I think catching the timeout error and doing another read might help resolve my issue. Because this is the first Labview program I have written, I'm just not sure how to go about doing that (Should I use serial read, visa read, etc., and how should I connect it to the Instrument Assistant?). Any suggestions on where and how I should place the re-read statement in the loop would be greatly appreciated. Thanks again.
Dave
12-01-2009 11:42 AM
Here's a version that does not use the I/O Assistant. If you still get a timeout, you may need to add a delay before the T(25) command.
12-01-2009 01:31 PM
Dennis,
Thank you so much for helping me and for making the changes to my program. I received an error message:
Error 85 Occured at Scan From String in (arg 1)
I just added a general error handler to your program, with no dialog, and it fixed the error 85. I will post the program so others can see - hopefully it can help someone else out too. Now I'll try to incorporate the changes into the original program that I posted. Thanks again and congratulations on the 20K.
Dave
12-01-2009 02:27 PM