LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format string problem

Hi,
Sorry if this has already been asked, couldn't find it in the pages of results that came up for string formatting.
 
I'm trying to output a string to serial, to control a robot arm for my undergrad final year project. At the moment it'll work if I put in a manually typed in string, but I want to make a nice VI GUI for the 'bot. To do this I need combined strings
 
eg
 
at the moment if I type in "joint\s1\s90\r\n", I'll get the 1st joint to move 90 degrees, and a return and a new line.
 
However, if I have these things combined using format string or concatenate string, it won't run.
 
Any ideas why? No one in my college seems to know, so I thought I'd ask here.
 
Thanks
0 Kudos
Message 1 of 13
(4,055 Views)
Are you concatenating the text "/s", "/r", and "/n" or are you using the LV primitives for these commands?  If you type the characters the robot probably does not recognize these as spaces, returns, and line feeds.
0 Kudos
Message 2 of 13
(4,033 Views)

"Are you concatenating the text "/s", "/r", and "/n" or are you using the LV primitives for these commands?  If you type the characters the robot probably does not recognize these as spaces, returns, and line feeds. "

I am, because when I type in the string as the input I have to include them. Does the concatenate function do it automatically?

0 Kudos
Message 3 of 13
(4,031 Views)
The concatenate function will not add anything to your string.  Can you post an example of the code you are using to concatenate the string?  One thing you may want to try is to probe the output of the concantenate and make sure you do not have any extra characters sure as an extra space at the end or something.
0 Kudos
Message 4 of 13
(4,031 Views)
I've tried that, it seems to be saying the exact same string as the code I've entered as a string constant. Is there any way to get the concantenated string to output using slash codes? Seems to me that if I include the codes myself I shouldn't have to do that, but I'm just really stuck on this at the mo.
0 Kudos
Message 5 of 13
(4,016 Views)
You should only require a format Into String function but in order to get the CR and LF, you need to right click on the format string and select '\' Code Display. If you use the concantanate string function, any string constant has to be set up that way as well or you use the constants on the string palette.
Message 6 of 13
(4,007 Views)
Did you try something like this?
 
      
 
Note: All strings are displayed as slash code...

Message Edited by paulmw on 11-28-2006 08:09 AM

Download All
Message 7 of 13
(4,008 Views)
What's wrong with doing just this:


  

Message Edited by smercurio_fc on 11-28-2006 09:01 AM

Download All
Message 8 of 13
(3,987 Views)
Don't have labview on this machine; I'll try these out later this evening and let y'all know how I got on.

Thanks for the help.

Cathal Scanlon
0 Kudos
Message 9 of 13
(3,974 Views)
Gave it a shot there a couple of days ago, Smercurio....s solution worked a treat. Thanks everyone.
0 Kudos
Message 10 of 13
(3,934 Views)