LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Appending CR and LF to string

Solved!
Go to solution

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
(816 Views)

@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
(811 Views)

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
(809 Views)

@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
(803 Views)

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
(791 Views)

@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


"Should be" isn't "Is" -Jay
Message 16 of 19
(773 Views)

@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.  

 

 


"Should be" isn't "Is" -Jay
Message 17 of 19
(772 Views)

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
(770 Views)

@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 


"Should be" isn't "Is" -Jay
Message 19 of 19
(765 Views)