07-26-2017 05:35 PM
Getting a framework error, when I intentionally plug out the com port and plug back in.
AFter manually playing around for a while inside the Device manager and removing and adding the VISA close vi, the application works.
Is there a way to get around this? Will post the vi if necessary.
07-26-2017 05:42 PM
Can you post the error you are getting?
07-26-2017 06:09 PM
Is the port you are using an actual Serial Port on the PC or is it a virtual COM port via USB connection (eg. USB to Serial converter)? Windows is known to do funny things (like lock ports) with virtual COM ports.
07-26-2017 08:03 PM
@looser_engineer wrote:
Getting a framework error
Sounds more like you are getting a Framing error. This happens when only a partial byte is received.
To help you get around this issue, we need more info. Do post your VI. Is this a USB-serial port?
07-27-2017 09:07 AM - edited 07-27-2017 09:08 AM
Please find attached my vi.
Yes this is a USB com port. I am reading information at 115200 baud rate, with 20 bytes coming in at every 10 ms. I only have to read the data and do not need to write it. I do get two kinds of errors. One is Buffer over run, when I stop the LabView program and re run it. This I took care of it, by adding the error in, error out connections.
Second is the frame work error - that happens when I intentionally unplug the usb, or Computer goes unresponsive and want to run the program again. When this happens I either wait life 15 minutes or play around with COM port in device manager. I am not posting the error numbers, because you can get that information if you have the vi. If not let me know, I can post the error code number. .
It is not a virtual COM Port, it is a USB port connected to a PCB board
07-27-2017 09:54 AM
looser_engineer wrote: I am not posting the error numbers, because you can get that information if you have the vi.
How could we get those errors without your hardware and setup?
But to get around the unplugging, you can create more states to your state machine. One of those states should be called when there is an error. From the error code, you can decide what to do (try to open again, shut down, etc). The other state you need to add is the Connect. Your code that is done before your loop to initialize the COM port should be moved into this state.
07-27-2017 01:06 PM
I am unable to reproduce the error. I will post the error code, once I get it again. As of now, it is a framework error at VISA close.
Thanks for everyone's comments, if anyone has any suggestions for best practices in my VI, please post them.
07-27-2017 02:02 PM - edited 07-27-2017 02:03 PM
Hi looser,
if anyone has any suggestions for best practices in my VI, please post them.
- Use AutoCleanup more often.
- I think I already mentioned to make the "display mode" indicator visible for strings and numbers, when they don't use the default display mode!
- You can show a label for constants and put your comment in there so they always stay with the constant (like "Header J")…
- You can replace the string indicator "Current State" by an enum indicator directly wired to the state enum…
- I would put the VISAClose after the while loop: no need for an additional case structure…
- Those "small" case structures used to select the next state could be replaced by Select functions: the code is more easy to read…