Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange init serial port issue

Hello:
My Labview application is reading data from the COM1..COM6 ports (I have
added a MOXA serial board to get 4 more ports). I am using RS232 reading
on each port (old legacy Vis, 9m long communication cables). The devices to which I am connected are weigh scale that continuously send weight readings to the Labview app through 3-wires RS232 (RD, TX and GND). Everything goes well for hours and hours. Then after a while (maybe after power is cut and restarted on the PC side?) I restart the PC and launch Labview. If I try to init the serial port that I use to connect to the weigh scale I get an error 37. I also tried to init thru HyperTerminal right after restarting the PC and could not. The only thing that works to unlock the port is
this:
- unplug the weigh scale communication cable from the Moxa connector
- restart the PC
- relaunch LV or HyperTerminal

Unplug then restart Labview or HyperTerminal is not sufficient.

To the same Moxa board I connect other devices such as PLC or PC through serial ports but never see any problems even after restarting the Host PC. So there is something strange with weigh scales (I tried two different brands) but what? I cannot use the built-in serial port as it is already in use by another application.

Does someone out there have an explanation and ways to avoid this very annoying problem?
Thank you very much, I am completely lost,
Christophe
0 Kudos
Message 1 of 5
(3,983 Views)
Since this is not a National Instruments serial product you may need to seek technical support from Moxa. LabVIEW/VISA accesses the serial port using the driver provided by Moxa via the Win32 API. Thus if the serial driver has a problem it will also be seen in LabVIEW as well as programs like HyperTerm.

Since it is extremely rare that restarting the computer doesn't free the port, and your case requires a physical disconnection, I can only guess that some sort of modem line condition (CTS, RI, etc.) is causing the Moxa driver some problems. Does a hard boot (power off, not a system restart) clear the problem?
0 Kudos
Message 2 of 5
(3,983 Views)
Chris:
Thank you for your help. I investigated the problem further and this is what I found. I am still clueless so if you think of other tracks that I might explore I would be glad to hear them.
- Hard boot (power off, remove power cord, restart) does not release the port
- I change the port ie. I used the built-in COM1 PC port, got the communication, could read char, then restarted the PC and fell into the same trap: could not init the port (Labview). I did the same after restarting and could not open the port with HyperT. Hence it is not a Moxa issue.
- The question is: how can I resolve that, is it an HW or SW issue, a combination of the two, has it got something to deal with WIndows 2K, are there some tools that allow to diagnose whi
ch service or application grasps the serial port during the boot sequence? Or is it a problem during the shutdown sequence that the port is not released properly?
TIA,
Christophe
0 Kudos
Message 3 of 5
(3,983 Views)
Apart from the possibility you mentioned (of another application grabbing the serial port during boot) it's also possible that *no* application can access that port after the boot. That happens because of a driver/win2k initialization error (which could be caused by the devices being connected to the port while the computer is booting).
To determine if it really is an initialization error you can open VISA Interactive Control (VISAIC for short) via the start menu "National Instruments>>VISA" shortcut. That can show you if the port/resource is valid but simply busy (i.e. the possibility you mentioned) or not even valid because of a driver/win2k initialization error (in which case you may have to contact Moxa).
0 Kudos
Message 4 of 5
(3,983 Views)
I found it!
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q131/9/76.asp&NoWebContent=1
Because the weigh scale is emitting continuously Windows thought that there was a mouse attached and locked the port.
Ch. Content
0 Kudos
Message 5 of 5
(3,983 Views)