Jump to content

SCPI commands


Marijan B

Recommended Posts

Hi!

During the writing of a simple program to test SCPI commands for my instrument, I stumbled on a puzzle. When I send the *IDN? command and afterwards try to read the response, the string I get is ´1. If I do it again, response is the same. Only after the third reading do I get the serial number of the instrument. The same thing happens when using MAX test control panel.

The instrument is HM1508-2 (oscilloscope from Hameg), it is connected over USB. I use VISA Open, Write, Read, Clear and Close functions.

What could be the problem and how can I make the program get the correct response every time? I can post a picture of block diagram.

Thank you.

Link to comment

What could be the problem and how can I make the program get the correct response every time? I can post a picture of block diagram.

A block diagram is always better when asking questions. The issue may be on the end of the o-scope; I expect you'll need to call their technical support.

Tim

Link to comment

Hi!

During the writing of a simple program to test SCPI commands for my instrument, I stumbled on a puzzle. When I send the *IDN? command and afterwards try to read the response, the string I get is ´1. If I do it again, response is the same. Only after the third reading do I get the serial number of the instrument. The same thing happens when using MAX test control panel.

The instrument is HM1508-2 (oscilloscope from Hameg), it is connected over USB. I use VISA Open, Write, Read, Clear and Close functions.

What could be the problem and how can I make the program get the correct response every time? I can post a picture of block diagram.

Thank you.

Is the unit addressable? You may be seeing the units address prepended. The manual will tell you more.

Link to comment

Is the unit addressable? You may be seeing the units address prepended. The manual will tell you more.

Here is the image of the block diagram. Drivers have been created by using VISA Driver wizard because MAX couldn't recognize the instrument with original drivers installed. Maybe that is the issue. For acccess mode on VISA Open I tried Load Configured Settings but nothing changed. Also, tried byte count from 1024 to 8192. Wait function is here to give the instrument some time before reading. You have to run this code three time before it gives the correct string in the read buffer.

I am sorry, but I don't know what does "addressable"mean and couldn't find any reference on "address" in the manuals.

post-17552-127443061362_thumb.jpg

Link to comment

There is equipment out there that uses termination characters. I think by default VISA has termination characters on. The o-scope may be using what VISA thinks is a termination character as a separator for some reason. You can use a property node to change the VISA settings. You should check with Hameg, but it is likely you either need to disable termination characters or change the termination character.

post-11268-127444125489_thumb.png

Link to comment

As can be seen from the image, I've put in the Property Node and set both the Termination Character Enable and the Suppres End Enable to TRUE. It works!

I feel there is still something fishy, though not sure what. But, nevermind, it works :). One more question: is it neccessary to have VISA Clear function?

Thank you all for your advices.

post-17552-127446126326_thumb.jpg

Link to comment

As can be seen from the image, I've put in the Property Node and set both the Termination Character Enable and the Suppres End Enable to TRUE. It works!

I would have thought that you wanted Termination Character Enable to be set to FALSE. But I don't have the stuff in front of me. As long as the thing works.

One more question: is it neccessary to have VISA Clear function?

I honestly have not used the VISA Clear function. According to the help it just clears out the transfer buffers. It might be a good practice to use it after opening your VISA session, but definitely not necessary.

Link to comment

One more question: is it neccessary to have VISA Clear function?

I consider it good practice to open the VISA connection and then clear out any "garbage" that may be sitting in the buffer. I don't see how it'd be necessary before closing a connection.

Tim

Link to comment

I consider it good practice to open the VISA connection and then clear out any "garbage" that may be sitting in the buffer. I don't see how it'd be necessary before closing a connection.

Tim

VISA Clear is in fact not really about flushing host data buffers but some sort of SCPI operation. For GPIB it issues the Selected Device Clear GPIB bus command, for USB TM Class devices (Instr Resource) it sends the INITIATE_CLEAR and CHECK_CLEAR_STATUS commands on the control pipe. For RS-232 it does indeed flush the buffers, sends a break and flushes the buffers again.

So I'm not sure it will clear the host buffers of the connection in all cases. For that you have the VISA Flush IO Buffer node.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.