Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

myrio timing problem

Hello,

 

I'm new to myRIO and currently trying to use the PWM output to modulate a sinusoidal signal. See the attached code derived from this post: frequency matching problem with myrio!!

 

Main VI.png

 

The PWM frequency is set to 40 Hz, the frequency of the sinusoidal signal is 1 Hz.

When I run the VI (as far as I understand thats the so called interface mode with the front panel displayed on my desktop), the code works well. Also deployed and run standalone there is no problem.

 

As I would also like to generate higher frequent signals, I then changed the dt of the timed loop to 10, which means it should run at a rate of 100 kHz.

 

Run with these parameters, the signal still doesn't look right anymore, and after a few seconds, the connection to the myRIO is lost. I then need to power cycle the myRIO in order to connect again.

I thought this might have to do with the code running in interface mode, creating so much overhead that the loop cannot run as fast as intended.

But when I deploy the code to the myRIO, it doesn't resolve the problem.It's even worse:

When the code is set to run at startup, it's not possible to connect to the myRIO again. It seems to me that the code uses all of the processors resources so that it cannot communicate with the desktop pc anymore.

 

Does that mean that the myRIO isn't capable of running the loop at a rate of 100 kHz at all? If so, are there possibilites to increase the loop rate?

0 Kudos
Message 1 of 2
(6,045 Views)

The problem here is that using that ExpressVI you send data to the fpga, to a compiled fpga file which does the tasks you ask for. All this is done in the express-vi. Ofcause beeing a express-vi, this takes some overhead. This express VI simply takes longer, than the time you gave it to finish. If you connect the output finish late, you will see the result. You have a lot of finished late loops. Because the loop has a higher priority, than the systemconnection to the net, you loose connection.

Here yeah, it is unlikely you could programm a loop that fast in Realtime.

Fortunaltely you can programm the FPGA yourself!

So what you could do, if you want to create a pwm there, create a FPGA file which outputs exactly what you want, and just start it once. And it runs, as fast as the fpga is able to. Please refer to the examples in the sample projects how to programm the FPGA.

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