11-04-2010 02:36 PM
1. How do I Input Termination Charecter (\r\n) into Format into String Function.
It seams that there is a mismatch of Variablew/representation when I use the Pink LV EOL Constant.
2. What is the Format Spesificatopn (%) for (\r\n), in Format into string function input Constant.
Thanks.
Solved! Go to Solution.
11-04-2010 02:46 PM
You can just hit the return key on your keyboard to enter new lines. If you change your string constant to show '\' codes (right-click and select '\' Codes Display) then you can see the explicit '\' codes and change \n\n to \r\n.
11-04-2010 02:56 PM
I did that, (Code display is in "\") but in the output string instead of showing \r\n it shows D. maybe somthing wrong with the Formating.
11-04-2010 03:00 PM
Please attach a small VI containing the string in question as default data in a string control. (make current value default before saving).
11-04-2010 03:19 PM
was not able to set defalt value, but I used any Integer number.
1. why the output is D instaed of \r the display mode is "\"
2. Why it is only D which is \r, but not \r\n for EOL.
3. why it is not 0D. How to make it displat hex 0D.
11-04-2010 03:27 PM - edited 11-04-2010 03:30 PM
You are not sending the byte x0D which is a carriage return, but sending two characters of "0" and "D". That is not the same thing. If you set your string indicator to hex code display, you'll see. You do not want to use the Format into String function.
Create a string constant. Set it to \code display. Type in \r. Now you have a carriage return. If you set it to hex code display, it will show 0D.
11-04-2010 03:32 PM
Now you are asking something different. Casting an EOL to a number doesn't make much sense since the EOL is platform-dependent. On Windows it's two characters: CRLF. On Linux it's LF. On Macs it's CR. If you explicitly want to add a CR LF then do as I said and simply enter that directly in the format string. As far as what to have it display, simply change the display mode.
It appears that you are trying to send commands to some instrument that requires byte values. In that case I think what you really want is to have the Type Cast on the number.
11-04-2010 03:35 PM - edited 11-04-2010 03:36 PM
If you format as %x, you are translating the unprintable characters to letters and numbers. That's not what you want.
Here are two possible solutions:

11-04-2010 03:54 PM
Thank you all very much
11-04-2010 03:58 PM
YOU ALL WERE VERY HELPFUL
HOW CAN I ACCEPT ALL OF YOUR SOLUTIONS.