LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close comport(visa) causes crash

Highlighted

I use the normal Visa commands, to configure, write and read to the serial comport.

 

The last command I send to my serial device, causes the device to continuesly transmitting packets. - this is correct, as this

is the mode I want my serial device in before closing down the comport

 

The problem is, because the receive buffer keeps on getting data from the device, closing the comport causes labview to eventually crash.

 

 

Any advise?

 

Goose

0 Kudos
Message 1 of 18
(1,997 Views)
Highlighted
Is there a long delay between when you send the last command to instruct the device to go into continuous mode and when you actually close the com port?  Are you sure the com port is actually closing?  It doesn't make send that LabVIEW would crash.  If you close the com port, the PC should just shutdown the buffer and would ignore anything coming into it on the receive lines. 
0 Kudos
Message 2 of 18
(1,995 Views)
Highlighted
I have also experienced this problem using a USB to serial converter. It may be the USB to serial converter driver that causes the crash. I did not dig deeper into this problem because I could control the instrument in such way that it stopped transmission before I close down the port. After this the problem was gone


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 18
(1,981 Views)
Highlighted

I am really stuck now, and not sure what to do!!!

 

Is there a long delay between when you send the last command to instruct the device to go into continuous mode and when you actually close the com port?  -> there is a delay, but I cant see this making any difference?

Are you sure the com port is actually closing? - No idea, how can I confirm this?

It doesn't make send that LabVIEW would crash.  If you close the com port, the PC should just shutdown the buffer and would ignore anything coming into it on the receive lines.  -Thats what I was hoping for too

 

The bottom line is, my program crashes, and does not seem to release the comport.

How can I go about debugging this, or fixing this?

Do you have any field engineers who can visit me to look at this problem?

 

Many Thanks

Goose

0 Kudos
Message 4 of 18
(1,963 Views)
Highlighted

What kind of serial port are you using. Do you use a laptop or desktop computer?



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 18
(1,958 Views)
Highlighted

Standard Com1 of my desktop PC, using NI Serial VISA...

 

I've tried many things which all reflected back to the issue that my device keeps sending data to the port, when I close it.

Sometimes, after my application completed (and not crashed), I can not open that serial port with something like hyperterminal for instance, as

it reports the port can not be opened, which means, labview did not close the port.

 

 

0 Kudos
Message 6 of 18
(1,952 Views)
Highlighted
Do you use HW handshake? If you do then you can stop the transmission temporally by using the appropriate handshake line. http://digital.ni.com/public.nsf/allkb/1ECEFAA7AD52994986256966005356EA. After you have done that, you flush both the transmit and receive buffer before closing the port. If this does not work, skip the port close command and use the  Quit Labview function to shut down Labview. This should free up your com port. Use it as a last resort. If you tell us more about your setup we may work out other solutions.

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 18
(1,939 Views)
Highlighted

Are you using the latest and greatest version of NI-VISA? They where some similar issue back in about LV 7.1 days.

 

Do you really want to keep the widget transmitting and THEN close the port?

 

How about flushing the buffer before the close?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 18
(1,925 Views)
Highlighted

Thanks all for the replies!

 

I am using Visa 4.4, this is the latest right?

 

I am not using Handshaking lines, and therefore not possible to deassert RTS to stop the the device transmitting.(tried it already)

 

To close the port, I flush the tx and rx buffers and then close the port immediately, but problem still occurs.

 

I can not shut down Labview, as after I close the port, I have to open it again for something else with the same application.

 

Is it possible to post you (NI) my hardware and software to have a look at this problem?

 

0 Kudos
Message 9 of 18
(1,918 Views)
Highlighted

morngoose wrote:

...

 

Is it possible to post you (NI) my hardware and software to have a look at this problem?

 


Clarification: Only those contributors that have blue colored bars under their names are NI. Every that has replied to you so far are just volunteers trying to help out.

 

Check the NI Drivers and download (search on this web-site) to see what the latest and gretest version are.

 

You can zip-up your application and when you submit another reply to this thread, look fo rthe "Add Attachments" link under the "Submit Post" to attach your code.

 

Mention which version of LV you are using so people don't waste their time only to find they don't have the version you are using.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 18
(1,915 Views)