LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetInQLen (comport) = -3

LOL!

 

I just thought I'd share an amusing story in case someone else runs into this..

 

I'm adding a piece of code to an existing TestStand sequence.  The code is written in CVI.

The original code takes care of the serial port configuration, house cleaning and opening the port.

It also does a whole bunch of things that take a lot of time before it gets to my code.

 

Well...  I kinda moved my code up the sequence before the serial port configuration.  However, I did do the port configuration and opening within the CVI code along with a nice comment saying that the TesStand Sequence took care of this.  

 

Went away from this code due to another project.  Came back, saw the comment, and thought "now why did I not comment out this code, the sequence already does that".  Plus I was working on a bug...  Needless to go into details..

 

Compile the code to get a fresh re-start..  

Then I kept getting a run-time error.   Put some pop-up messages which indicated that there was -3 bytes at the port(GetInQLen (comport) = -3).  And it tried to read -3 bytes (yes... I have to add a Case Statement)  thus causing the run-time error.

 

 

Message of the Day:

 

It does not matter how much experience you have at coding.  When multiplexing projects, you will multiply the foolish errors and the level of foolishness will increase to the power of the number of multiplexed projects.  LOL!! 😄

 

Hope this post helps someone in the future..

 

R.

Message 1 of 3
(3,698 Views)

Did you flush the inqueue first?

 

NI changed the CVI serial driver around ver 8.5 I think it was.   There were some problems with the threading they use to keep track of the queues as I recall, including a race condition associated with the queue flush I believe.

 

Curiously, the .NET serial driver also uses a worker thread to manage the inqueue, and there is also a known bug due to a race condition between the various driver threads.

 

Menchar

0 Kudos
Message 2 of 3
(3,674 Views)

I was flushing the queue later in the code. 

I'm developing with CVI-7.1.

 

I figured I'd post this amusing story.  

 

Thanks for the info.  I do know that we are moving to a newer version of CVI soon.

 

R

0 Kudos
Message 3 of 3
(3,666 Views)