09-13-2015 12:08 PM
I have an Omega CN7200 PID temperature controller that I’m trying to talk with using VBA code and NI-VISA. The CN7200 has a RS-485 bus, but I bought a 485-to-USB converter from Omega. As a test, I loaded Omega’s SW and the 485-to-USB driver, and I can read and write the CN7200 registers just fine.
There is no NI-VISA driver specifically for the CN7200. There is one for the CN7500, so I downloaded the NI-VISA driver for this. Since the CN7200 and CN7500 use the same Omega user’s manual, I’m hoping this driver will work. However, while the NI-Max sees the 485-to-USB converter on COM6, when I do a IDN query I get this message: “Read Operation Error. VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.” Another window says “Return Count: 6 bytes”. So it seems like data is being read but not recognized.
Any ideas on how to troubleshoot this? (I’ve tried changing the NI-Max baud/data bits/stop bits/term character, but nothing seems to help. I also extended the time out to 2000ms.)
09-13-2015 02:07 PM
09-13-2015 02:25 PM
I can only read and write the registers when using Omega's non NI-VISA software and menus. When using NI-Max or VBA code (with NI-VISA running) I always get read errors.
I'm trying to read the IDN just as a basic test to see if reads are possible. From my experience with other instruments, if you can read the IDN then you can read the other registers too.
09-13-2015 03:26 PM
09-13-2015 10:55 PM
Using NI Max I tried to read some registers other than the IDN value, and I get the same timeout error.
"What happens when you run this driver that you downloaded?"
When I use Ni Max to query a register, I assume that it is using the downloaded driver. So when I use it I get the timeout error.
Simillarly, when I try to do a VBA instrument read of a register I get an exccution error at the read line in the code. Again I assume the NI-VISA driver is in use.
I keep thinking that there is some small configuration problem. For example, I noticed in the Max attributes that the term char should be 0xA. But when I changed to this, still no luck.
I'll look in to a port sniffer.
09-14-2015 01:13 AM
09-14-2015 08:26 PM
Okay, I see now that MAX is a standalone utility that does not use any driver. So I guess even if I find a configuration within MAX that works, there is not guarantee that when using VBA code and the NI-VISA driver that the VBA code can communicate with the Omega instrument. For VBA code there seems to be little to do configuration-wise since the code relies on the driver to work. It seems like it will simply work or not work. Is that true?
I know from MAX that the device is seen at ASRL6::INSTR. The VBA code below follows the conventions normally used for communicating with an instrument, but I simply get read errors at each read attempt whether for the IDN or the 1000H instrument-specific read command (to read the temperature). I don't know what else to try.
Set ioMgr = New VisaComLib.ResourceManager
Set instrument = New VisaComLib.FormattedIO488
Set instrument.IO = ioMgr.Open("ASRL6::INSTR")
instrument.WriteString "*IDN?"
idn = instrument.ReadString()
ActiveSheet.Cells(1, 1) = idn
instrument.WriteString "1000H"
Meter_Read_Group = instrument.ReadString()
ActiveSheet.Cells(7, 1) = Meter_Read_Group
09-14-2015 10:07 PM
09-14-2015 10:15 PM
Virtually every reference on the web for writing VBA code shows reading the IDN as one thing to check. I also do that with all of the other instruments I am using and it works fine. Also, as shown in the code example I sent I was also checking a specific command code and it did not work either.
I don't like your tone, so I'd like to end this disucssion here.
09-14-2015 10:28 PM