LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Appending CR and LF to string

Solved!
Go to solution
Highlighted

I would consider getting rid of the ASRL End Out node.  Just include the \n in the string constant as well.

 

If you use the VISA Serial Config function, you can get rid of the VISA open and the entire property node since it is built into the Serial Configure.

 

Double check your data type for the 256 constant.  You have a coercion dot there.  Whenever creating constants or controls, you are best off just right clicking on the functions terminal and picking Create Constant.  Then you'll get a constant of the correct datatype.

 

Show what your raw string is coming from the VISA Read.  Make sure that shows what you want.  I don't understand what you are trying to format the string into.

Message 11 of 19
(173 Views)
Highlighted

@Demisicus wrote:

Many thanks RavensFan, it was that sneaky i32 causing the timeouts all along. Smiley LOL I now nearly have the program working, my returned String appears to be empty (displays only \r\n). I will have to be far more careful with my types.


I've scraped my knee tripping over that one a long time ago.  It's something you'll never forget.  😄  (But also something you might trip over from time to time, regardless.  Umm... yeah.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 12 of 19
(168 Views)
Highlighted

It looks like you wired the String indicator to "remaining string". That's why the response is \r\n. It should be connected to the "abc" terminal. Better yet use Trim Whitespace.vi

Capture.PNG

Message 13 of 19
(166 Views)
Highlighted

@RavensFan wrote:

I would consider getting rid of the ASRL End Out node.  Just include the \n in the string constant as well.

 

If you use the VISA Serial Config function, you can get rid of the VISA open and the entire property node since it is built into the Serial Configure.

 

Double check your data type for the 256 constant.  You have a coercion dot there.  Whenever creating constants or controls, you are best off just right clicking on the functions terminal and picking Create Constant.  Then you'll get a constant of the correct datatype.

 

Show what your raw string is coming from the VISA Read.  Make sure that shows what you want.  I don't understand what you are trying to format the string into.


To expand on this - and this is the reason I don't use the property - is because that is a serial bus only property, making your code work for only the serial bus.  To make it "bus-agnostic", add the term chars to the end instead.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 14 of 19
(160 Views)
Highlighted

Brilliant, thanks very much to everyone - I've now got the vi to work perfectly! I'll add a comment on the article as a warning to future readers.

 

I look forward to learning more about labview! Smiley Happy

Message 15 of 19
(148 Views)
Highlighted

@Demisicus wrote:

Many thanks RavensFan, it was that sneaky i32 causing the timeouts all along. Smiley LOL I now nearly have the program working, my returned String appears to be empty (displays only \r\n). I will have to be far more careful with my types.


As well as that awesome advice on showing display format on string constants... show a label on constants and at least use the data type!  Sweet catch Bill! The other Bill Mr. Ko

Message 16 of 19
(130 Views)
Highlighted

@Demisicus wrote:

Many thanks RavensFan, it was that sneaky i32 causing the timeouts all along. Smiley LOL I now nearly have the program working, my returned String koappears to be empty (displays only \r\n). I will have to be far more careful with my types.


It appears empty because.....

The new line returned hides the single line of non whitespace text displayed in the indicator:D

 

Oops, no you are getting the wrong string from the search.  

 

 

Message 17 of 19
(129 Views)
Highlighted

Yes, a few daft mistakes but fortunately for me you guys have a lot of patience. Smiley Very Happy

0 Kudos
Message 18 of 19
(127 Views)
Highlighted

@Demisicus wrote:

Yes, a few daft mistakes but fortunately for me you guys have a lot of patience. Smiley Very Happy


Trust me,  sometimes it is entertainment 

Message 19 of 19
(122 Views)