LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication - Labview Framework error

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. 

0 Kudos
Message 1 of 8
(2,973 Views)

Can you post the error you are getting?

0 Kudos
Message 2 of 8
(2,966 Views)

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.

0 Kudos
Message 3 of 8
(2,956 Views)

@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?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 8
(2,931 Views)

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

0 Kudos
Message 5 of 8
(2,881 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(2,873 Views)

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. 

0 Kudos
Message 7 of 8
(2,862 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(2,852 Views)