Go to Post If you pay attention to every nut job on ChiefDelphi, you'll never reach a decision. - JesseK [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 07-02-2012, 23:39
dakaufma dakaufma is offline
Registered User
AKA: David Kaufman
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Silver Spring
Posts: 28
dakaufma is an unknown quantity at this point
Re: Efficent way to send data?

Quote:
Originally Posted by DominickC View Post
Yes, that's exactly what I want! I've taken a look at the attached VI and I'm pretty lost.

I see where I am able to define my distances, and my outputs. I assume that the first distance (10) corresponds to the first row of outputs (1, 3, 5). From there, you lose me.
You understood it correctly. The distances constants correspond to the outputs constants. To clarify, I could compile them into a table:

------------------------------------------
|Distance range | Out 1 | Out 2 | Out 3|
|below 20 | 1 | 3 | 5 |
|20 to 30 | 2 | 6 | 8 |
|above 30 | 5 | 8 | 9 |
------------------------------------------


I'm tunneling the measured distance and the array of distances into a for loop. The tunnel for the distance array is an auto-indexing tunnel -- basically instead of outputting the array it outputs the value in the array that corresponds to the current iteration. Within the for loop I'm using a shift register to keep track of an index. If the measured distance is less than the distance at the current index I replace the remembered index with the current index, but if the measured distance is greater than the distance at the current index I keep the remembered index. When the loop completes, the shift register contains the largest index with a distance less than the measured distance. I then extract the output from the outputs array at that index.

For background information on for loops, auto-indexing, and shift registers in LabVIEW see this NI site: http://zone.ni.com/reference/en-XX/h...op_structures/
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi