LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data drops using visa serial read

Solved!
Go to solution

I am having an issue using visa serial read when transferring an array from one PC to another.  The write PC is transferring the data consistently as seen from the probe on the string going into the write.  The exe reading the string however displays the string array once and then on the next read displays an empty string.  This seems to toggle back and fourth between a full string of data and an empty string.  The vi the data is coming from does show a consistent updated array but the exe reading the array (via RS 232) toggles from empty to full at the read rate of the loop which is set to 1 Hz.

0 Kudos
Message 1 of 9
(2,664 Views)

Sounds like you are sending two termination characters with each VISA Write. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 9
(2,659 Views)

It would seem so but all I have in the write is a visa confiure-serial and then a visa write in a loop and a wait 1000 ms timer.

0 Kudos
Message 3 of 9
(2,654 Views)

Post your code with sample data on the string.

 

Before you do that though, let me give you a short tutorial:

Create a new probe

Capture.PNG

at the pop-up wizard Select New and click next-

at the save prompt name the file StretchyString

A Probe editor (Like the control editor) will pop-up.  use the Right Click menu to do the following:

  • Visible Items- Display Style
  • Fit Control to pane

Close the editor.

Now go back to your BD and probe the write buffer with the "StretchyString" probe.  You can change the display style to HEX or \Codes and see if the termination charater is there.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 9
(2,643 Views)

In both vis the visas are at the bottom of the BD bellow the main while loop.  I did not quite get what you wanted regarding the probe but I gave it a whirl.  Also, I found another symptom.  The data in the array not only goes empty every other loop integration but the numbers also shift position occasionally.

Download All
0 Kudos
Message 5 of 9
(2,636 Views)

Thats because you are making a common mistake.

 

You look like you are writing a EOL constant to the network in the 8x15....vi (On Windows this is a \r\n "Cr+Lf" or 0x0D0A) Plus an additional Linefeed.  You get the EOL from the array to spreadsheet file and the COM port is configured to send a linefeed at the end of each send.  That explains what you are seeing since you will read sssssss\n  and \n

 

 but, you have set your read to #Bytes at port and THAT IS WRONG!  you have an EndOfMessage condition that is deterministic to wit: the message is complete when a \n is sent. 

 

Set bytes to read LARGER than the maximum expected message length and put a "Trim Whitespace" after the array to spreadsheet string Or replace the array to spreadsheet with "Join Strings" from the advanced String folder in vi.lib (not on the palattes).

 

 

The custom probe StretchyString lets you inspect string data with a lot more options than the basic probe and can show you charaters you otherwise would not see.

Capture.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 9
(2,623 Views)

I tried putting a control on the "bytes to port" and set it to 1000 (577 expected).  I also added a blank space after the array to spreadsheet function but, I still get the same behavior.  Is there a way to remove the extra linefeed beside searching the string and deleting it.

0 Kudos
Message 7 of 9
(2,612 Views)

Correction....It did work.  The trim white space worked.  The other you mentioned of using instead of the array to spreadsheet stings that would not be on the pallet.  Would it be located under the Progam files/NI/Labview ect vi.llb?  Kudos and thanks.

0 Kudos
Message 8 of 9
(2,604 Views)
Solution
Accepted by topic author teslac

@teslac wrote:

e Progam files/NI/Labview(Vers) vi.llb\Advanced String?   Yup

 

Kudos and thanks.  There are buttons for thoseSmiley Wink  Kudos- just click the Star under my avatar  and Mark the solution- (Options >OO> on your right, at the top of each post "Accept as Solution")

 

 

There are three reasons for this:

  1. Other contibutors know they can concentrate on helping out elswhere
  2. It easier to search for the next person with a simillar problem
  3. We just LOVE "Solutions- Delivered"

 


"Should be" isn't "Is" -Jay
Message 9 of 9
(2,601 Views)