LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to match the entire string or pattern

I have two message reading from the device right after turn on. If my program is running and then the device is turned on the message is block header CR/LF, prompt (!), POWER ON, CR/LF, and block trailer. Same for reconnection instead of POWER ON its Reconnect. How do I search for this kinda pattern.
I think this message is printed out right after the initialization of the protocol.
0 Kudos
Message 1 of 5
(2,400 Views)
Look at your returned text with "/ Codes Display". Right click on any front panel string control or any diagram constant and select "/ Codes Display". This will allow you to see the non-printable characters like CR LF TAB etc. In your Match Pattern function, uses the identical strings to match. See the attached example for determining which string you get.

~Tim
0 Kudos
Message 2 of 5
(2,400 Views)
Thanks Tim,
I have few more things that I am looking to do. first of all the power on message is at the initial power on, restart after a power failure or internal reset. The reconnection message is detected once the after disconnection or loss of carrier. If the power failure happens I would have to reinitialize (I think). So i think I am only looking for a "reconnection" message, till that occurs I can go on and run my program fine if that message comes up that means that I have either lost power or disconneted. I want to see indicator for power on and plus watch for reconnection message. How should I do that. Thanks
0 Kudos
Message 3 of 5
(2,400 Views)
Sorry for the upper discription.
I am not actually looking for a power on since we will have the unit ON. The Reconnection message is only sent by the device when re-establishing connection. Since this device will be running for 8 hours to record temperature , it should re-establish connection its self and once connection is establish an alarm log is generated to report all points currently in alarm.
0 Kudos
Message 4 of 5
(2,400 Views)
Once you've recieved the message you're looking for, you can then use the case statement to execute another set of instructions or subvi. For example, if you get the "RECONNECT" string you could ignore it, if it is the data string then process it.

One note, where I have a > (greater than) on the output of the match pattern function, it should be a => (equal to or greater than). If the string is not found, the vi returns a -1.

I'm not sure how your program flows exactly. Is this a subvi that runs in a loop within a main program? If not, there are few things that happen only once. For example, since your initialization is not in a loop, it only happens just the one time. Same for the section of code where you check for RECONNECT or PO
WER ON.

You could contact me at shanahan@oasislex.com if you need further help.

~Tim
0 Kudos
Message 5 of 5
(2,400 Views)