LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect directly to myrio with labview via usb without using the startup wizard

Solved!
Go to solution

I'm trying to create an application to connect to myrio via usb.I want to connect directly to Myrio via a "vi". I want to check the LED and pin status with a "vi" that I created myself without the need for a startup wizard.In short, whenever I want, I want to connect and disconnect from myrio via "vi".I tried to do this with serial communication but was not successful. Does anyone know a way to do this?

 

Every suggestion or idea counts.

0 Kudos
Message 1 of 11
(2,288 Views)

Several questions that are not clear from your description:

  • Do you want to connect to any myRIO (assuming that it is already configured to work with whatever version of LabVIEW you are using)?  Note that a "vanilla" myRIO won't necessarily have any support software (such as the myRIO Software Toolkit) installed.
  • Are you planning to connect via the USB port or through WiFi (assuming you have a myRIO-1900)?  Do you know how to find the IP of the remote myRIO?
  • Are you planning to "prepare" the myRIO by loading a specific Software Package into it that runs as a "Startup Executable" that automatically starts running when you plug in the myRIO to a power source?  If you do this, you "know" what is running inside the myRIO, and can "reach out" to it and interact with the specific Executable that you programmed and downloaded into it.

The myRIO, like any other computer, is just fancy electronics without software.  So you need to think about whether you are going to write the Software resding in a particular myRIO, or rely on "whatever happens to be in a random myRIO" (in which case, you are probably out of luck).

 

Bob Schor

0 Kudos
Message 2 of 11
(2,258 Views)

 

 

I want to interact with myrio via usb. I want to connect directly to the usb comport with a 'vi' that I will create myself with a myrio that I have programmed before without the Myrio startup switch.

 

 

  • Are you planning to "prepare" the myRIO by loading a specific Software Package into it that runs as a "Startup Executable" that automatically starts running when you plug in the myRIO to a power source?  If you do this, you "know" what is running inside the myRIO, and can "reach out" to it and interact with the specific Executable that you programmed and downloaded into it.

 

Apart from the connection method in this picture, I want to connect directly via vi via usb.

0 Kudos
Message 3 of 11
(2,233 Views)

I don't understand to what you are objecting.  You open LabVIEW, plug in the myRIO, open a LabVIEW myRIO Project (which gives you some "hooks" to find the myRIO), and are ready to program (or otherwise use the myRIO).

 

Are you bothered by the fact that with the myRIO Software Toolkit installed, when you plug in the myRIO with USB, NI starts the myRIO USB Monitor?  One solution to that is to not plug the myRIO in to USB.  Alternatively, you can figure out what routine NI has running that periodically "looks for" the myRIO on USB and disable this utility.

 

I routinely use a myRIO without the USB Monitor by connecting over WiFi.  Of course, there's still the "trick" of figuring out the myRIO's WiFi IP, but that's another story.

 

What, exactly, do you plan to do with the myRIO?  Just "out of the box" without your having installed your own Executable that runs when the myRIO starts, it won't do very much without your opening a LabVIEW-RT Project and loading it with an appropriate LabVIEW program.  But why not just do that in LabVIEW (and not worry about the Monitor)?

 

Bob Schor

0 Kudos
Message 4 of 11
(2,207 Views)

*I don't understand to what you are objecting.

- I don't know exactly how to do it instead of objecting.

 

* You open LabVIEW, plug in the myRIO, open a LabVIEW myRIO Project (which gives you some "hooks" to find the myRIO), and are ready to program (or otherwise use the myRIO).

-I am doing these already, there is no problem in this regard.

 

Are you bothered by the fact that with the myRIO Software Toolkit installed, when you plug in the myRIO with USB, NI starts the myRIO USB Monitor? 

-It's okay. I can cancel this with ni_usbmon.exe, that's not my problem of course.

 

*I routinely use a myRIO without the USB Monitor by connecting over WiFi.  Of course, there's still the "trick" of figuring out the myRIO's WiFi IP, but that's another story.

-I want to connect via usb, not wifi

 

* What, exactly, do you plan to do with the myRIO?

- After connecting the myrio to the computer with the device usb port, I can write the program and upload it to myrio and I can see the information (video, led status) on the monitor. There is no problem with that. But if I run this program "Test usb.vi" directly without running "usb control myrio.lvproj", labview doesn't see a target, the run icon looks broken and doesn't connect with myrio. because "Test usb.vi" doesn't see myrio as a target. I want to create an application that can connect with myrio by running the '' Test usb.vi '' file directly without running the "usb control myrio.lvproj" file. And I want to do this through the usb device port.

 

 * Just "out of the box" without your having installed your own Executable that runs when the myRIO starts, it won't do very much without your opening a LabVIEW-RT Project and loading it with an appropriate LabVIEW program. But why not just do that in LabVIEW (and not worry about the Monitor)?

-I agree with you on this point. I have no problem with that.

Download All
0 Kudos
Message 5 of 11
(2,200 Views)

You will need to learn a lot of things to do that.

 

- Discovering RIO devices programmatically:

You use the NI System API for such things. This allows you to enumerate the connected RIO devices. The RIO device even when connected through USB will be seen as TCP/IP device since it uses the Ethernet over USB communication.

 

- Let it run as standalone device

You will have to develop an application to run on the RIO that starts up automatically and opens a network listener on a well known port. Over this network listener you implement your own protocol that implements all the commands and responses your device should be able to handle.

 

- Make it all work

Your host application will enumerate the RIO devices and select the one of interest, determining its IP address. Then using this IP address and the well known port you selected above, you open a TCP/IP communication to your application on the RIO and start communicating.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 11
(2,192 Views)

Thanks for your insightful answer Are you telling me I need to use IP to connect to Usb?I'm not trying to send video over usb, I will just listen and write the information in Myrio.

0 Kudos
Message 7 of 11
(2,183 Views)

USB is simply a cable. What goes over it depends on the device profile. The RIO devices with no real Ethernet port implement Ethernet over USB and that is how LabVIEW connects to them too.

In terms of LabVIEW the device looks simply like an Ethernet device both on controller as well as on the host side.

In my experience it is not as stable and robust as real Ethernet connectivity but it does work.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 11
(2,180 Views)

I think there is no serial com port that can be used for serial shopping other than pins A and B, it will still need to be connected over TCP / IP to use the other usb port. Am I wrong. The Usb port on Myrio cannot be used with NI-VISA for serial shopping.

0 Kudos
Message 9 of 11
(2,171 Views)
Solution
Accepted by topic author constructionworker

@constructionworker wrote:

I think there is no serial com port that can be used for serial shopping other than pins A and B, it will still need to be connected over TCP / IP to use the other usb port. Am I wrong. The Usb port on Myrio cannot be used with NI-VISA for serial shopping.


It's not really clear what you are saying here. The myRIO has simply one 3.3V TTL serial port on the A and B connecter respectively: https://forums.ni.com/t5/myRIO-Student-Projects/RS-232-Serial-to-TTL-Converter/ta-p/3530996?profile.....

You typically need an according 3.3V TTL to RS-232 converter to connect that to any device. You could also connect this to a serial port on your PC (real or virtual USB-RS232 port). This still requires an application on both sides which communicate together and need to be written by you.

 

USB is an electrical and physical connection standard. What logical information travels over it is dependent on the protocol used. There are a myriad of protocols such as HID (typically keyboard and mouse), Video, network, serial data, etc. and each of them has its own protocol (sometimes several different ones for the same type of device which do not have to be and often aren't compatible). Devices only can talk together if on both sides compatible protocol drivers are installed, and in the case of USB it is possible to run multiple concurrent protocols over the same wire, although most devices don't use that. The myRIO could theoretically also implement a COMM port on that USB connection so that the device looks to the PC like a serial port, but the network variant is much more powerful and versatile, and simply requires applications on both sides to be able to access TCP/IP sockets.

 

It would require some serious tinkering with the Linux installation on the myRIO in order to use the USB port as a serial COMM port instead.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 11
(2,158 Views)