09-02-2008 09:47 AM
09-02-2008 10:19 AM - edited 09-02-2008 10:25 AM
09-02-2008 10:22 AM
You are running your code too fast. Even if you don't perceive any delay when watching at the Hyperterminal screen, this does not mean that there isn't.
Give the device a chance to prepare and send you the response; the simplest way is to put a delay between the write and the read: 100 or 200 ms may be enough.
09-02-2008 11:47 AM
Hi Guys,
Thanks very much for all the suggestions. Unfortunately the writing to the instrument is still not consistent. I have included delays in two places in addition to the visa close. I am attaching the VI again. Please see if I am making any other silly mistake. I have tried enabling and disabling the termination character but it makes no difference at all. I have tried all combinations of \n, \r and \r\n but as before the stupid instrument is behaving in exactly the same way.
Thanks again,
Sunil.
09-02-2008 12:12 PM - edited 09-02-2008 12:17 PM
You need to wire your VISA reference & error cluster for ALL cases within a Case Structure.
Also, your WAITs were a bit useless..
I modified your VI. Try the one attached.
R
I forgot to ask which LV version you are using. The attachment was edited in LV8.2.
09-02-2008 12:21 PM
Here is what I meant in my last post by removing the Case Structures.... Try this one..
Do you expect any substantial delays between the time to write and to read? If so, use the Delay control to adjust the wait period.
R
09-03-2008 09:56 AM
Thanks Joe. The read was working well with the changes you made to the VI. The write was having the same problem. It would write sometimes but not at other times. I ended up putting the write in a while loop which goes on writing until someting appears on the read buffer. It works within 1-2 seconds - which will do for my present requirement.
Many thanks for your help!
09-03-2008 12:26 PM
Serial Write do not need to be in a loop. Almost sounds a communication speed... or end-of-line character...
Glad it works, but I'm curious, when you say you write in a loop, do you send the same command over & over again?
Maybe you simply need to put additional delay between the write and the read, using the Delay control. It is in ms, so you could try 1000ms, for instance..
R