Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Control Problems

Hey Dennis,

Something must have been wrong with that computer, or some crucial element was missing cause I was able to run the executable on a different computer.

However as things normally go for me, one fixed problem leads to another.

When I run the executable I receive a 1073807339 timeout error during the scan procedure.

Attached is my subVI which deals with the write/read.  It should be very familiar, you helped me with it not long ago and for some reason I'm getting a timeout error out of no where. 

I would attach a screenshot of the error and where it happens but that would involve me switching computer set-ups, saving to disc, switching computer set-ups again, and then loading it up here.  The error occurs between the read of 100 byte count, and the write of the \06 ack command.

 

Thanks,

0 Kudos
Message 11 of 26
(3,193 Views)
Does the exe on the other computer have a duplicate set of instruments or did you move them over from the one that was having problems? If it's a different serial instrument, it almost seems like it is setup with a different termination character. In Hyperterminal, a CR and LF are both sent. In the VI, only a CR is sent and the read requires a LF to terminate.
0 Kudos
Message 12 of 26
(3,188 Views)

I only have one set of instruments, that being the lone spectrophotometer.  The different termination characters seems odd to me as well.  Could that have something to do with the computer and/or operating system it is running on?  Or just different serial ports (all with the same settings)?

At this current time I have three computers at my desk that I've been trying to get this executable to run on.  The one computer that I created the entire VI on operates on Windows 2000, and the executable runs fine there.  The other computer runs on Windows 2000 and the executable does nothing on this computer.  The last computer runs on Windows NT and I was able to get the executable to store the baseline and begin the scan, but like I mentioned before the scan didn't complete and the executable kept running trying to read information that wasn't available due to the incomplete scan.

I added the line feed to the carriage return and nothing happened when I ran the executable.

Thank you for your continuous support and effort Dennis

0 Kudos
Message 13 of 26
(3,188 Views)
Sorry, i've read this discussion and i have some doubts. I'll call "pc1" the pc on which you create VI and "pc2" the pc on which you install your executable file. On "pc1" create installer without support for VISA. On "pc2" try to install VISA (and MAX) before install the VI created on "pc1". You can download VISA drivers from www.ni.com under "Support" space. Then on the "pc2" start MAX and look COM ports: is there COM 1 ? (i think you link your instrument to COM 1). Now: in your VI have you inserted a configuration block for serial port? If you haven't done this, you must choose correct values for parameters from Control Panel of Windows (Baud Rate and the others...). Then try to lunch your VI.
0 Kudos
Message 14 of 26
(3,160 Views)
Hi,
 
All of the settings (baud rate, data bits, stop bits..) are all correct.
I have checked through MAX the COM1 port, and am able to send/receive commands.
My only problem at this point comes down to reliability.
 
For the past month I've had no problems getting all 5 of my scans to complete.
The day I create an executable from my original vi, I am all of sudden having troubles completing scans.  Sometimes all of them will finish, sometimes 2 or 3 will finish, and sometimes none finish.
 
I know that the executable was and can be created properly because I have seen it work a dozen times efficiently and completely, giving me all 5 scans, 5 plots, and 5 percentages.
 
Possible reasons for my error -1073807339...?
  1. By writing large amounts of data my timeout isn't great enough and the data isn't sent completely.
  2. Reading too many bytes than actually being sent.
  3. Termination character/ACK response...
  4. Serial settings...

Why I am almost certain none of these apply to me..

  1. I've used everything from no timeouts, and timeouts going up a second at a time all the way to 10 seconds for each write/read command.
  2. Up until now, I've been reading a constant of 100 bytes and haven't had any problems.  All of a sudden the read asks for 0 bytes, but I read for 100 bytes, and a timeout error occurs before I can send my ACK response "\06".  This is a complete mystery to me as to why it stopped working consistently out of no where.
  3. I've used "\r" to terminate each command and am confident this is not where the error comes from.
  4. Both computers and spectrophotometer are set to 9600 baud, 8 data bits, 1 stop bit, no parity, and no flow control.

WIth all of this being said, the read/byte count seems to be the root of my errors.

 

Thanks

0 Kudos
Message 15 of 26
(3,152 Views)

So many times, when I've had serial problems, it had to do with misinformation regarding the sending device and the expected number of bytes. When you hard code 100 bytes into Read, you'd better be sure that's the number. I've always had better luck with counting the bytes inside a loop, even when I know the expected bytes. This usually has to do with junk in the buffer, or bad documentation of the device - for example, some device manufacturers may not count CR and LF as characters. Sometimes, protocol is used such as addressing or checksums.

Also, as mentioned, \r and \r\n can get you, especially when combined with Use Termination Character during setup.

99 times out of 100, I've been able to diagnose my serial issues with the attached VI. It's not elegant, but it works for me. Go to the Diagram and setup the port for your device (9600, etc) before hitting Run. Good luck.

Richard






Message 16 of 26
(3,135 Views)
Hey Richard,
 
This is quite the vi Smiley Tongue.  Not only is it well built, but it's user friendly.  I am able to "manually" control my spectrophotometer.  I input ?SCU to the write buffer, check off insert carriage return and then I "Do It".  After that I quickly insert \06 into the write buffer and every so often I "Do It" so that the spectrophotometer receives the ack response, and I get a complete scan.
 
I now know for sure that my error comes in the VISA Read.  I keep getting a 0 byte count at serial port and the VISA Read loop just goes on forever searching for bytes.  When I try to have a constant of bytes to read, that is when I get the usual timeout error.  Perhaps it is time to contact the manufacturer of this device again.
 
Thanks for any/all help
0 Kudos
Message 17 of 26
(3,103 Views)

Steve, I'm glad you found it useful. I just noticed I have a new version which I didn't attach! It is now attached. A bit more friendly and cleaned up.

By the way, are you using Ocean Optics spectrometers? If so, I feel your pain. Smiley Mad

 

Richard






Message 18 of 26
(3,102 Views)
Hey Richard,
 
This one looks a lot fancier.  I'll be sure to check it out Smiley Wink.
 
I'm using a Cecil CE3055 Spectrophotometer (http://www.cecilinstruments.com/aurius-1.html).  I'm sure mine and yours both cause, and have caused, a great deal of frustration.
 
Regards,
 
0 Kudos
Message 19 of 26
(3,095 Views)

Broken Arrow:

What's up with the Ocean Optics specrometers? Just asking because we have many of them here in use and I was one day considering writing LabVIEW code for them.

Thanks

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 20 of 26
(3,092 Views)