NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
aguptaweb
Posts: 6
0 Kudos

How can I pass boolean data between VisualBasic and LabView?

[ Edited ]
Hi all,
I'm relatively new to Visual Basic, but a few other people in my lab have programmed in it. They want an interface between their program and one that I've created to control a robot. My program in LabView takes boolean controls to output commands to move parts of this robot. They have an external controller that interfaces with their VB program and they want a way to send those boolean controls to my program. What is the best way to accomplish this?
I also want to be able to control the program through LabView as well, so I'm thinking "or" gates with one input as the data from VB and one as the button I've already set up.
Oh yeah, I'm running LV 8.5, interfacing with Mindstorms NXT kit, Windows Vista.

Any suggestions, ideas, etc, on how to best do this will be greatly appreciated, and any examples you can point me to would be great. If you need any more information from my end let me know. Thanks!


Message Edited by aguptaweb on 07-24-2008 10:35 AM
Member
aguptaweb
Posts: 6
0 Kudos

Re: How can I pass boolean data between VisualBasic and LabView?

Hi again,
I was looking at this example:
http://zone.ni.com/devzone/cda/epd/p/id/3430
and it seems to be the sort of thing that I'm looking for. Now like I said, I don't know too much about programming in VB, so what should I do to change the output from an operand to a boolean? It seems like it shouldn't be too hard... am I oversimplifying?
Active Participant
waldemar.hersacher
Posts: 1,120
0 Kudos

Re: How can I pass boolean data between VisualBasic and LabView?

[ Edited ]

In my opinion the best way is to use the ActiveX Automation interface.

Make an application from your LV program and check the box in the Build Properties to active the ActiveX server.

From the VB side you must open a reference to the automation server and the VI. You can set the controls,run the VI and get the reult back.

Make a search in the tutorials or knowledge base with VB ActiveX and LabVIEW. There was example code creted by NI.

in labview\examples\comm\freqresp.xls is an example shipping with LV how to do this in MS Excel.

Added:

There was an overlap in our posts.

I don't know VB.Net, I have little knowledge about VB. In VB I created variables of type variant and filled the part according to the data type in LV. Go in the LV help to Fundamentals>>Windows Connectivity>>Concepts>>Using ActiveX with LabVIEW. Start from there to find the technics and information your VB programmers need. There should be a table how to map LabVIEW data types to varant data types.

Message Edited by waldemar.hersacher on 07-24-2008 06:09 PM

Message Edited by waldemar.hersacher on 07-24-2008 06:17 PM
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Member
aguptaweb
Posts: 6
0 Kudos

Re: How can I pass boolean data between VisualBasic and LabView?

Waldemar,
Thanks for the information - I'll try building the VI as an app and show it to the VB programmers, I'll also look at the help file you referenced. I'll get back if I need any more specifics, but right now I think what our plan is is to feed a stream of 1's and 0's to LV... apparently this stream is easily accomplished in VB. Now my question is what's the best way to interface with that stream in real time?
Knight of NI
Posts: 18,064
0 Kudos

Re: How can I pass boolean data between VisualBasic and LabView?

The example that you pointed to uses VB.NET. VB.NET is not the same as VB. Two different beasts. VB.NET is not an upgrade to VB - it's a different language. Thus, you need to first device whether you're going to be using VB or VB.NET.
Member
aguptaweb
Posts: 6
0 Kudos

Re: How can I pass boolean data between VisualBasic and LabView?

[ Edited ]
mercurio,
that's a good point - I'm told we are programming in VB.NET.


Message Edited by aguptaweb on 07-24-2008 02:12 PM
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page