Marijan B Posted May 20, 2010 Report Share Posted May 20, 2010 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. Quote Link to comment
Tim_S Posted May 20, 2010 Report Share Posted May 20, 2010 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 Quote Link to comment
ShaunR Posted May 20, 2010 Report Share Posted May 20, 2010 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. Quote Link to comment
Marijan B Posted May 21, 2010 Author Report Share Posted May 21, 2010 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. Quote Link to comment
crossrulz Posted May 21, 2010 Report Share Posted May 21, 2010 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. Quote Link to comment
Marijan B Posted May 21, 2010 Author Report Share Posted May 21, 2010 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. Quote Link to comment
crossrulz Posted May 21, 2010 Report Share Posted May 21, 2010 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. Quote Link to comment
Tim_S Posted May 21, 2010 Report Share Posted May 21, 2010 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 Quote Link to comment
Rolf Kalbermatter Posted May 22, 2010 Report Share Posted May 22, 2010 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.