03-29-2010 02:26 PM
I have created a simple VI to write and read to a stepper motor controller. The command I am sending returns the status of the home and limit switches that connect to the controller. This is a nibble hex value. I am trying to compare the reply string from the VISA read to a regular expression to check whether the limit switch has been activated. I am getting an error 4702 which states there is a null character in the reply string and my regular expression does not account for that. I have read through the regular exopression help page numerous times and I have to say NI could explain that a little better (IMHO). Anyway, I was hoping some of the VISA gurus could look at the attached VI and help me build the regular expression for the Match Regular Expression function.
The reply string from the controller is in the VI block and I have labeled it as such. What I am trying to do is capture the number 15 in the reply string. That number can be any number between 0 and 15.
03-29-2010 09:03 PM
I don't know about the reg expr functions.
But what you could try is a string search and replace, and replace the 00 (in string display hex mode) with an empty string before feeding it to the reg ex.
03-29-2010 09:35 PM
03-30-2010 07:16 AM
Great!! Thanks for the replies. I'm confused with identifying the NULL character in the controller reply string. The <\00> is that the square block at the end of the string? There is a strange character at the beginning of the string, a "y" with two dots over it, is that the NULL character. When I use hyperterminal I get the same string as in the VI posted... "y/0'15" but with no square block at the end. Which charcter is the NULL charcter in that reply string?
I will probably use Raven Fan's suggestion. That's a good idea! Thanks again for your help!!
CJ
03-30-2010 07:33 AM