Ethernet control DMM6500 problem

I tried to use ethernet to control my DMM6500.

Picture one shows that I use SCPI to read voltage on DMM6500 and it works.

Picture two shows that I use SCPI to set a current range it doesn't work.

I have no idea how it can't work.

read voltage on DMM6500 Set a current range on DMM6500

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 :)

The first parameter to viWrite and viRead is a session identifier returned by viOpen. See the documentation for viOpen for an example.

 

 

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)

Use this instead:

    String com_str = "READ?"
    Variable length = strlen(com_str)
    viWrite(uuu, com_str, length, retCnt)

Putting it all together:

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)
    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.

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?
 

In reply to by hrodstein

hrodstein wrote:

Also, this makes no sense:

Variable length = strlen(com_str)        // What is com_str?
viWrite(uuu, "READ?", length, retCnt)

It's a mistake copy just ignore it

hrodstein wrote:

Does the instrument send a terminator such as LF or CRLF? 

I'm not sure about that. Maybe try VISAWrite and VISARead is a good choice.

hrodstein wrote:

It would be useful to know exactly what is going wrong. If you are getting an error, what is the error message?

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. 

Example.PNG (33.46 KB)

The SCPI documentation for the DMM 6550 says:

Quote:
A command string sent to the instrument must terminate with a <new line> character.

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:

Function Read_DMM6400_1()
    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