Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO Low Level VIs

Solved!
Go to solution

Good Afternoon,

 

I am trying to use the low level VIs with a myRIO. Here is the block diagram with everything stripped out except the low level digital output blocks (the timing has also been modified to create one pulse every two seconds):

 

Low Level VIs.png

 

I know that there are easier ways to do this, but I am trying to learn how to use the low level VIs. When I run the code, everything seems to work properly (the debugger proceeds normally with no errors), but the output just stays at 3.9 volts.

 

Can anyone tell me what I am doing wrong? The project is attached (zipped).

 

Thank you,

 

John

0 Kudos
Message 1 of 9
(8,456 Views)

I also tried using a case structure. The LED flashes, but the output does not toggle.

 

Low Level VI Case Structure.png

 

0 Kudos
Message 2 of 9
(8,447 Views)

This is almost exactly like the VI shown in this video (I could not make it exactly - my version  of LabVIEW must be different).

 

http://www.youtube.com/watch?v=4nzr7THqU8U

 

Low Level VI Read.png

 

The VI runs with no errors, but it always reads high from the input.

0 Kudos
Message 3 of 9
(8,442 Views)

Hey there John,

 

Do you get the expected results using the Express VIs? What if you use the View Code option in the Express VI and copy paste that code into your program? Which port/connector are you using on the myRIO?

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 9
(8,412 Views)

Good Morning Daniel,

 

Yes, I get the expected results using the high-level Read, Write, and PWM VIs. In recent months, I have written myRIO programs using high-level VIs that control a DC motor in a feedback loop, drive a stepper motor, perform state machine operations, etc. I am sure that the myRIO is working properly.

 

For the last example (the Read example), I selected View Code from the VI, and pasted it into my program - it didn't work. The image that I posted, and the accompanying attached program is the copied-and-pasted code, with a while loop and some blocks added to monitor the output. I have tried several different inputs and outputs (DIOs) on the A connector with no luck. Maybe the additional blocks that I added are preventing the code from working properly, but I don;t know any other way to monitor the I/O.

 

Is there any low-level VI documentation available; or maybe some examples? The reason that I am trying to learn to use the low-level VIs is execution speed. I assume that the low-level VIs perform faster than the standard high-level VIs.

 

John Murphy

0 Kudos
Message 5 of 9
(8,401 Views)
Solution
Accepted by JTMurphy

John,

 

I'm not sure what could be going on here. I tried all three pieces of code that you posted and all of them worked for me. The only thing I changed was I was using the DIO ports on connector C. I know this is kind of a dumb question, but are you sure you are using the correct pins on your connector? Are you sure you have set the correct DIO lines in the program? Perhaps try the B or C connector to see if those work.

 

You are right in that the low level VIs perform faster than the Express VIs.

 

Also, for the first bit of code, here would be a better way to structure it, using the RT Wait Next Multiple VI to control the loop rate:

myriolowlvl.PNG

Daniel C.
Applications Engineer
National Instruments
Message 6 of 9
(8,372 Views)

Good Afternoon Daniel,

 

This morning, I submitted my problem to the NI Support Group. I tried several suggestions, and finally the program worked.

 

I am not sure exactly what fixed the problem, but I tried a different myRIO, deleted the Real-Time Application (under Build Specifications), deleted the program blocks, rebuit the program, rebooted the myRIO (and my computer), and switched to port C. The program worked. I then switched back to port A and the original myRIO, and it still worked.

 

Thank you for the suggested diagram. Although I tested the program using a 1 second timer (easier to test), I am planning to run the loop at about 100 usec, if possible.

 

John Murphy

0 Kudos
Message 7 of 9
(8,367 Views)

Glad to hear you got it working! Though the solution sounds quite strange.

 

Unfortunately for a loop time of 100 usec, that's a frequency of 10kHz which is not recommended to run on real-time. (The loop would be so fast that it would probably eat up all of your CPU time). If you are using the myRIO for 2014, you can download the myRIO High Throughput Add-on, which adds additional a high throughput fpga personality as well as high throughput myRIO VIs where you can set your data and rate for IO. Here's the download:

http://www.ni.com/download/ni-myrio-software--2014/4938/en/

 

The other option would be to write your own FPGA code to do this. This would be your only option on myRIO 2013.

Daniel C.
Applications Engineer
National Instruments
0 Kudos
Message 8 of 9
(8,355 Views)

Good Morning Daniel,

 

The NI Support Engineer suspects that it may have something to do with the start-up execution and front panel display. The front panel display code is stripped out of the application when it is set up to run at start up. Anyway, the problem is solved.

 

I am running LabVIEW 2014, and the High Throughput add-on may be a good option for many of my applications. Hopefully, I will have time to try it soon.

 

The FPGA is an option for higher throughput, but the compile time is very long. I use myRIO to teach a Control Systems course, and we could probably not compile the FPGA code more than once in a laboratory session.

 

Thank you,

 

John Murphy

0 Kudos
Message 9 of 9
(8,344 Views)