02-25-2014 12:00 PM
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.
Solved! Go to Solution.
02-25-2014 12:04 PM
Sounds like you are sending two termination characters with each VISA Write.
02-25-2014 12:13 PM
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.
02-25-2014 12:39 PM
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
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:
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.
02-25-2014 12:54 PM
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.
02-25-2014 01:36 PM - edited 02-25-2014 01:39 PM
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.
02-25-2014 01:50 PM
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.
02-25-2014 02:07 PM
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.
02-25-2014 02:15 PM - edited 02-25-2014 02:17 PM
@teslac wrote:
e Progam files/NI/Labview(Vers) vi.llb\Advanced String? Yup
Kudos and thanks. There are buttons for those 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:
- Other contibutors know they can concentrate on helping out elswhere
- It easier to search for the next person with a simillar problem
- We just LOVE "Solutions- Delivered"