Bushra Posted February 16, 2006 Report Share Posted February 16, 2006 Hi, My labview program is communicating with a microcontroller that is sending me a message "The angle is: 255 degrees". I am trying to get labview to take the value of the angle and turn the knob on my user interface to 255 degrees. I was wondering if anyone knew how to get labview to distinguish the number from the string of characters coming through the serial port and turn the knob to the appropriate position. Thankyou. Quote Link to comment
orko Posted February 16, 2006 Report Share Posted February 16, 2006 Hi, My labview program is communicating with a microcontroller that is sending me a message "The angle is: 255 degrees". I am trying to get labview to take the value of the angle and turn the knob on my user interface to 255 degrees. I was wondering if anyone knew how to get labview to distinguish the number from the string of characters coming through the serial port and turn the knob to the appropriate position. Thankyou. Attached a quick example using "Scan From String" in the String Function Palette: Download File:post-3266-1140131641.vi Joe (orko) Quote Link to comment
i2dx Posted February 17, 2006 Report Share Posted February 17, 2006 Attached a quick example using "Scan From String" in the String Function Palette:Download File:post-3266-1140131641.vi Joe (orko) sometimes you get just crap over RS232, so i would put a case structure around the knob, connect the scan from string error out to the case selector and make it the no error case. If you dont connect the error out at scan from string nodes, you will get these nasty error-popoups, if the scan fails, which you maybe don't want to see, because it's "normal" that sometimes the scan from string fails ... Quote Link to comment
orko Posted February 17, 2006 Report Share Posted February 17, 2006 sometimes you get just crap over RS232, so i would put a case structure around the knob, connect the scan from string error out to the case selector and make it the no error case. If you dont connect the error out at scan from string nodes, you will get these nasty error-popoups, if the scan fails, which you maybe don't want to see, because it's "normal" that sometimes the scan from string fails ... Thanks for the reminder, i2dx. Error handling is always the fun part Quote Link to comment
Mike Ashe Posted March 14, 2006 Report Share Posted March 14, 2006 If you search the LabVIEW examples you will find a VI something to the effect of "Extract Numbers from String.vi" that will take a string input and return an array of the numbers it finds. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.