Jump to content

Communicating with microcontroller using labview


Bushra

Recommended Posts

Posted

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.

Posted
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)

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

Posted
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 :)

  • 4 weeks later...
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.