AnsweredAssumed Answered

Using VISA's viClear with VBA & EXCEL

Question asked by jbbiot on Jan 22, 2013
Latest reply on Feb 6, 2013 by connectivity
We use a number of Agilent instruments and we program all of them using VBA & EXCEL over IEEE488. VISA COM is the main enabler and simple .WriteString and .ReadString commands are the mainstay of the input/output code. However, every once in a while we need to get data from a serial device and we typically have problems.

For example, we currently need to get the temperature data (in the form of a 32 term string) from a DS18S20 Dallas Semi device. The command for this is "D". We notice that if we use the Agilent Interactive IO and send a "device clear" before we do a send and receive using the "D" command, we get the entire 32 term string with no hiccups. And we can do this repeatedly absent issues.

However, if we use VBA to .WriteString  the "D" and .ReadString the reply (in a VISA COM regime) we need to do this +three times in a row+ before we get the full 32 term string. The first two times pieces of the string are parsed out into smaller sections and sometimes it does not work at all.

When we run the *IO Monitor* we can see that the Agilent Interactive IO is sending a *viClear* when we hit "device clear". So if we could do a device clear equivalent to a viClear when using VBA (+before+ sending the "D" command) then we would be fine and the code would work.

So - is there a way to use the VISA command *viClear* within VBA +when using VISA COM?+  

Outcomes