LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does a VI work in a blank project, but not in a myRIO project?

I'm building a calculator in LabVIEW that connects to the myRIO. 

 

jb0375_0-1711618888697.png

 

In a blank project, the VI works perfectly. All the operators function as required. However, when I copy and paste the block diagram into a new myRIO project, the VI no longer works. When I press a button instead of printing it on the string indicator, it is unresponsive.

So my first question is, why does a LabVIEW VI work in a blank project, but not in a myRIO project? Is it the event structure? Secondly, how can I adjust the VI so that it functions in a myRIO project?

0 Kudos
Message 1 of 3
(177 Views)

I think you cannot handle UI events on a myRIO, see this:

https://forums.ni.com/t5/Academic-Hardware-Products-myDAQ/UI-on-myRIO/td-p/3363168

0 Kudos
Message 2 of 3
(155 Views)

@raphschru wrote:

I think you cannot handle UI events on a myRIO, see this:

https://forums.ni.com/t5/Academic-Hardware-Products-myDAQ/UI-on-myRIO/td-p/3363168


Yes, that is the reason.  Although the myRIO is a small computer and can run software that "looks like LabVIEW on the PC", an important difference is that the PC runs Windows, which has support for "communicating with Humans" (such things as support for keyboards, mice, displays, etc.), while the myRIO runs NI's LabVIEW Real-Time Linux Operating System (type "What is a Real-Time Operating System (RTOS)?" into Google, and it will probably take you to NI's clear description), which is designed to be maximally responsive (or "deterministic") to the code that you write.

 

Did you notice there is no place to plug a Keyboard, or a Mouse, or a Display into the myRIO?  It is designed to let you download a program to it, start it running, and it will pay very close attention to any inputs that it receives through its various ports + the push button + TCP/IP traffic, either through the USB device connected to your PC or through WiFi.  What you can do is in your Real-Time Project, write code for the Host (PC) that reads the keyboard and sends the commands (over TCP/IP) to the myRIO, the myRIO "interprets" the commands and performs the arithmetic, then sends the answers back to the PC (again, over TCP/IP).

 

There are several ways to do this communication.  I've been using Network Streams, with one PC-to-myRIO Stream sending "Messages" (Commands + data) to the myRIO, and the myRIO sending "Messages" to the PC.  In your case, as you process keystrokes, you can send strings to the myRIO, or you can parse the strings on the PC and send "expressions" to the myRIO (such as <number><operator><number>) and let the myRIO interpret the expression and return "the answer".

 

Bob Schor

0 Kudos
Message 3 of 3
(131 Views)