LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

communicate with how many devices in labview?

Is labview a good program to use when trying to communicate through gpib when using 6+ gpib devices in the same system?  I feel like the block diagrams will get really messy really fast trying to put all of that together.
0 Kudos
Message 1 of 4
(2,509 Views)
Do you have a better alternative?
0 Kudos
Message 2 of 4
(2,504 Views)

snwbrdr wrote:
I feel like the block diagrams will get really messy really fast trying to put all of that together.

You need to put a good & robust architecture so that it DOESNT get messy. Smiley Wink

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 4
(2,498 Views)
Hi snwbrdr, LabVIEW is like any other language. It takes planning to create a good program. There is no reason that a block diagram should be messy for *any* LabVIEW program, no matter how complex. If a block diagram is getting messy, it’s a sure sign you have gotten off track in your design.   Let’s take your example of communicating with six instruments. In a text based language you wouldn’t write a send/ receive routine for one instrument and then copy it six times. You would rightly be accused of writing spaghetti code. A change in the way you communicated would mean editing six places and keeping them the same somehow. The same holds true for LabVIEW. You certainly shouldn’t have six COM routines on your block diagram.  You might, for example, have a cluster of 6 items, where each item would be an instrument ID and a command. Feed this cluster into a “for loop” with indexing. In the “for loop” is a COM routine (vi). On the output of the “for loop” you get an array of six results. That’s not a messy block diagram. So how does one avoid getting lost in a sea of wires? First make sure you understand the LabVIEW toolset (The Training): 
  • Know how to use clusters and arrays to group data items and keep things simple
  • Know how to use the indexing feature of LabVIEW constructs (for loops, while loops,) to greatly simplify and clean up your code
  • Know how to make and use state machines
  • Understand how Producer consumer patterns work (Queues)
 Before you start coding - do some planning (The Design): 
  • Create a block diagram of the major functions for you program.
  • Define the user interface – understand when and where the user has to interact with the program
  • Break the major functions down into smaller pieces that just do one thing
  • Define the interactions (data flow) between the pieces
  • Give careful consideration of how you will deal with errors – where and when do they need to be reported and how do they flow through the program
  • Choose a design pattern (Producer consumer, State machine, etc) that fits the requirements of the program as you have defined it
 When you are coding (The Implementation): 
  • If you did your planning, each piece that you work on should have a fairly well defined purpose.  Therefore each piece should be fairly simple.
  • If you start to struggle on a section, consider whether you are having trouble understanding how to implement the requirement in LabVIEW or do you need to modify your Design.
  • When your code is easy to implement, you know you are on the right track. Sure, there may be a section or two that are more difficult than others, but that should be rare. Most code should practically write itself.
 To summarize, you can write good clear code in any language including LabVIEW if you understand the toolset and take the time to design the program properly.  Conversely, you can also write code that is hard to implement, hard to understand, and hard to maintain in any language if you don’t take into consideration the issues I have listed above. I hope this is helpful,Steve 
----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Message 4 of 4
(2,474 Views)