Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial ring buffer and case issue

Solved!
Go to solution

Hello All,

 

I've got an interesting problem and having a tough time finding a solution, and thought a pair of fresh eyes might help!  I'm reading data in over serial using VISA.  That's going well.  I'm doing this continually and then appending to a string.  From this string, I look for new lines, and pull them off of the serial buffer string.  I then look at the lines to see if they have the appropriate commands, and if so, parse out those commands to control a case structure.

 

Now here's the interesting part.  When I started, I wrote a vi to take in some arbitrary multi-line string in, and parse out the sentences and data, and it works as expected, but when I do it with live serial data and the ring buffer, the case statement doesn't work.  Also, when I probe the parsed string that goes to control the case statement, it LOOKS right, but the case statement will not accept it.

 

Any thoughts would be greatly appreciated, I'm pretty stumped as to what's going on here.  I attached the 2 vi's.

 

Gurus?  Masters?

 

Thanks! 

--
Jim S
GRA/Colorado School of Mines
0 Kudos
Message 1 of 4
(3,361 Views)

Hi

 

I did not see big problems, the only problem I saw was the compare greater than zero that should be a greater or equal to zeroat least twice

This can be enough but I did npt look further

greetings from the Netherlands
0 Kudos
Message 2 of 4
(3,351 Views)
Solution
Accepted by topic author JimSchwendeman

Jim S,

 

I see a couple of problems.  As previously posted you should be using Greater or Equal? instead of Greater?.  The biggest problem is that you have a string constant set to '\n' but the constant itself is not configured for '\' Codes Display mode.

0 Kudos
Message 3 of 4
(3,338 Views)

Thanks Albert and Wayne,

 

After posting this, I realized I hadn't enabled the '\' visual for the string output.  Once I flipped this on, I was able to see a hidden \r that I hadn't caught.  I am curious as to why the regular expression doesn't chop that out, but otherwise, the problem is resolved.

 

Thanks again! 

--
Jim S
GRA/Colorado School of Mines
0 Kudos
Message 4 of 4
(3,329 Views)