I don't immediately see a problem here. I just remember that Keithley devices are for some reason a real pain in the a** to program. One thing not in the right order and the device refuses cooperation. It might be that you first have to reset the device once (sending *RST) before modifying settings, or maybe you need to first set the correct measurement mode (e.g., :SENS:FUNC "VOLT:DC"). I also never send the first colon (:) for any command and it works fine. Just keep trying with different examples from the manual until you get some reaction.
When you post code, copy the code and use the Insert Code Snippet option to insert it into your posting. That gives it standard Igor coloring, and also makes it possible to copy and paste into Igor. Folks reading your code may be able to try it out and suggest useful updates. You will usually get more useful answers that way.
It is common to paste code straight into the posting; if you do that, one of us admin types will often patch it up for you. But in this case, it would require a lot of typing :)
If you have a global string variable named ud_dmm6500 that contains a session identifier returned by viOpen then your Read_DMM6400_1 looks OK in so far as that parameter is concerned.
This
NVAR uuu = instr_1
is equivalent to this
NVAR uuu = $"instr_1"
so there is no need to use $.
Also, this makes no sense:
Variable length = strlen(com_str)// What is com_str?
viWrite(uuu, "READ?", length, retCnt)
Function Read_DMM6400_1() Variable retCnt String data = "" NVAR uuu = instr_1 String com_str = "READ?" Variable length = strlen(com_str)
viWrite(uuu, com_str, length, retCnt)
viRead(uuu, data, 1024, retCnt) returnstr2num(data) End
But I'm not sure that is right either.
Does the instrument expect to receive a terminator such as LF or CRLF?
Does the instrument send a terminator such as LF or CRLF? Ethernet does not have an END signal like GPIB so it may try to read 1024 bytes and hang until it times out. You might be better off using VISAWrite and VISARead. The latter automatically ends when the terminator character is received.
Quote:
Picture two shows that I use SCPI to set a current range it doesn't work.
It would be useful to know exactly what is going wrong. If you are getting an error, what is the error message?
I don't immediately see a problem here. I just remember that Keithley devices are for some reason a real pain in the a** to program. One thing not in the right order and the device refuses cooperation. It might be that you first have to reset the device once (sending *RST) before modifying settings, or maybe you need to first set the correct measurement mode (e.g., :SENS:FUNC "VOLT:DC"). I also never send the first colon (:) for any command and it works fine. Just keep trying with different examples from the manual until you get some reaction.
September 27, 2021 at 08:41 am - Permalink
When you post code, copy the code and use the Insert Code Snippet option to insert it into your posting. That gives it standard Igor coloring, and also makes it possible to copy and paste into Igor. Folks reading your code may be able to try it out and suggest useful updates. You will usually get more useful answers that way.
It is common to paste code straight into the posting; if you do that, one of us admin types will often patch it up for you. But in this case, it would require a lot of typing :)
September 27, 2021 at 12:13 pm - Permalink
The first parameter to viWrite and viRead is a session identifier returned by viOpen. See the documentation for viOpen for an example.
September 27, 2021 at 03:27 pm - Permalink
If you have a global string variable named ud_dmm6500 that contains a session identifier returned by viOpen then your Read_DMM6400_1 looks OK in so far as that parameter is concerned.
This
NVAR uuu = instr_1
is equivalent to this
NVAR uuu = $"instr_1"
so there is no need to use $.
Also, this makes no sense:
viWrite(uuu, "READ?", length, retCnt)
Use this instead:
Variable length = strlen(com_str)
viWrite(uuu, com_str, length, retCnt)
Putting it all together:
Variable retCnt
String data = ""
NVAR uuu = instr_1
String com_str = "READ?"
Variable length = strlen(com_str)
viWrite(uuu, com_str, length, retCnt)
viRead(uuu, data, 1024, retCnt)
return str2num(data)
End
But I'm not sure that is right either.
Does the instrument expect to receive a terminator such as LF or CRLF?
Does the instrument send a terminator such as LF or CRLF? Ethernet does not have an END signal like GPIB so it may try to read 1024 bytes and hang until it times out. You might be better off using VISAWrite and VISARead. The latter automatically ends when the terminator character is received.
It would be useful to know exactly what is going wrong. If you are getting an error, what is the error message?
September 27, 2021 at 05:24 pm - Permalink
In reply to I don't immediately see a… by chozo
Replay for chozo
Thanks for your suggestion I will try it.
September 27, 2021 at 05:40 pm - Permalink
In reply to If you have a global string… by hrodstein
It's a mistake copy just ignore it
I'm not sure about that. Maybe try VISAWrite and VISARead is a good choice.
When I use GPIB to set a current range it will change the unit on DMM6500 like the picture below.
It didn't work with ethernet. But the Read? command worked it will return a voltage from DMM6500.
Thanks for everyone's reply. I'm new here and also new to foreign forums. If I have something wrong let me know it.
September 27, 2021 at 05:59 pm - Permalink
The SCPI documentation for the DMM 6550 says:
I suspect that it also transmits an <new line> character (LF) when it sends a reply.
Also, it shows the read command as ":READ?", not "READ".
I would try this:
NVAR uuu = instr_1
VISAWrite uuu, ":READ?\n" // "\n" is linefeed (LF)
Variable reading
VISARead/T="\n" uuu, reading // /T="\n" means "terminate read on linefeed"
return reading
End
September 27, 2021 at 06:00 pm - Permalink
In reply to The SCPI documentation for… by hrodstein
I will try it later.
September 27, 2021 at 06:02 pm - Permalink