LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Channeled Message Handler Template not working on NI myrio

Solved!
Go to solution

Hi everyone! LabVIEW 2020 includes a CMH template, which contains a Message Handling Loop and an Event Handling Loop. I want to use this template on NI myrio.

 

I'm doing a typical control project. I would like to control and acquire data from displacement laser sensors, digital scales, vacuum regulators, and other electronics modules. I can control all my components using a simple While Loop, where I have to manually input values.

 

But I can't make the CMH template working on NI myrio. I create a project from the template and add a myrio target. Then I move the support VI folder (Enqueue Message.vi, Dequeue Message.vi, Abort Message Queue.vi) and the main.vi under the myrio target. Then I run the main VI and it's not working! The Message Handling Loop is initialized properly. But I can't enqueue any message. I included a snapshot of a similar Event Handling Loop. After I click the Generate Signal button, nothing happens.

 

Any suggestions? I just want to control my system using NI myrio and a CMH design pattern. Thanks!

 

LabVIEW 2019 with myrio

NI myrio 1900

CMH template provided in the NI LabVIEW Core 2 course.

0 Kudos
Message 1 of 6
(2,082 Views)
Solution
Accepted by topic author PurpleWINDD

Hi, PurpleWINDD.

 

I consider myself a "Champion of Asynchronous Channel Wires" and possibly (?) the "inventor" of the Channel Message Handler paradigm (which I have been using since LabVIEW 2016, with one project having multiple dozens of them running simultaneously).

 

I'm currently working on a LabVIEW RT Project that involves a myRIO.  My Host VI, of course, is based on my "standard CMH" design (I haven't looked at the CMH Template in LabVIEW 2020, but suspect it is similar to what I'm using).  I have tried to make the CMH work in the myRIO with LabVIEW 2019 (I'm running LabVIEW 2019 SP1 with the LabVIEW 2019 myRIO Software Toolkit), and was forced to abandon it as it proved "flawed" (I contacted NI Technical Support and reported the problem, which I thought was scheduled to be fixed in LabVIEW 2020).

 

I recently installed LabVIEW 2020, and attempted to move my Project to LabVIEW 2020 on the myRIO.  However, it appears that there is, at present, no myRIO Software Toolkit for LabVIEW 2020, and the LabVIEW 2019 myRIO Toolkit does not appear to support LabVIEW 2020 Real-Time Module.

 

I suggest you do what I (reluctantly) did, and for the LabVIEW RT code running on the myRIO, substitute a Message Queue implementation for the (much more appealing) Channel Message Handler paradigm.

 

Bob Schor

0 Kudos
Message 2 of 6
(2,073 Views)

Dear Bob,

 

I'll try the QMH template on the myRIO.

 

Thank you very much and have a nice day!

0 Kudos
Message 3 of 6
(2,018 Views)

Hi Bob.

 

I tried the Message Queue implementation you mentioned. Because I'm a newbie, I thought that I can use the Queued Message Handler (QMH) template provided in LabVIEW 2019. I created a project from the template and added a myRIO target in the project. Then I moved all the support VIs and the main.vi under the myRIO target. I run the main.vi and it didn't work! The same thing happened. I couldn't enqueue any message. After I click the "Do something" button, the program just got frozen.

 

You said you successfully used the Message Queue implementation on your myRIO. How did you achieve that? Is there any resources that you can point to me?

 

Thanks!

0 Kudos
Message 4 of 6
(2,009 Views)

Hi, Bob.

 

My bad. I didn't know that I should write user interface VI as well as the RT VI.

 

Have a nice day!

0 Kudos
Message 5 of 6
(1,993 Views)

About a month ago, I answered a similar question here.  Somewhere in there, I discuss creating two VIs (as I do for the CMH example) called "Receive Msg" and "Send Msg", which I didn't show in the Queue example, but you could create for yourself.  I'd model it on the CMH version, with the Queue coming in and going out through a "top" connector, and Send accepting two inputs, the "Selector" part of the Message (a String in the example, but I more frequently use an Enum) that has the Case Selector and the optional Variant input, Data.  Receive Msg works the same way, Queue coming in on the Top and Selector and Data being the top right outputs.

 

But what to do with that ugly Queue Reference that needs to be brought across from Receive Msg (on the left) and Send Msg (on the right), particularly if you need to decide inside the Case Selector what Message you need to send?  In the code I posted (where I just "made up" the QMH example), the Queue comes out and goes in on "side" connectors, where here I suggested you use a Top (or, if you wish, a Bottom) connector to get the Queue "out of the way".  Experiment and decide which you prefer.

 

This should work.  Don't try to add an Event Structure, and they don't work in the myRIO.

 

Bob Schor

0 Kudos
Message 6 of 6
(1,990 Views)