Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning period in timed while loops from local variable

Hello,

 

I'm trying to assign a local variable to a timed while loop running on a MyRIO to control the rate at which the loops run, but when I do this the loops do not run. Any help appreciated.

 

-T

0 Kudos
Message 1 of 13
(4,162 Views)

Hello TallGrass

 

I would like to know if you are in the VI is located in the FPGA or in the Real Time Target. It is just to try something here in my system. Also, feel free to attach a screenshot of your code.

 

Regards

0 Kudos
Message 2 of 13
(4,127 Views)

It is in the Real-Time Target. I don't have a copy of the code as I am away from my office but will upload a screenshot as soon as possible Monday morning. Thanks -T

0 Kudos
Message 3 of 13
(4,115 Views)

Hi TallGrass

 

I will be waiting for that info

 

Regards

0 Kudos
Message 4 of 13
(4,108 Views)

Here is a shot of my issue.

 

When I assign a value of 1000 to the sample period in the top loop with a local variable it doesn't run the loop, however the bottom loop still runs.

 

When I assign the value in the configuration box of the timed while loop it works.

 

Thanks,

-T

 

 

Sample Period Screenshot.PNG

0 Kudos
Message 5 of 13
(4,104 Views)

Hello TallGrass

 

Thank you very much for attaching the screenshot.

 

I am wondering about where are you writing the local variable? I am asking that because it might be possible in the specific moment where the time loop reads the local variable it did not have any value loaded yet.

 

On the other hand I would like to know why did you use a local variable to set it?

 

Regards

0 Kudos
Message 6 of 13
(4,096 Views)

The local variable is assigned in the frame before in a flat sequence. It is used a handful of other times to the period for timed while loops throughout my code, and thought it'd be better to assign it this way rather than connecting it directly to each loop. Maybe I should try connecting it directly?

0 Kudos
Message 7 of 13
(4,092 Views)

Hello TallGrass

 

Do you mean using a wire? Let's try that.

 

Regards

0 Kudos
Message 8 of 13
(4,081 Views)

A wire still doesn't work. When I probe it it says no value has been assigned. 

 

I guess I am confused on the order of operations being performed and am unsure why it is not being read before the loop starts

0 Kudos
Message 9 of 13
(4,072 Views)

Hey TallGrass

 

I was trying to recreate the issue you are having here and I realized something but first of all I would like you try:

 

  1. Delete the local variable you have wired in the dt loop parameter 
  2. Right click on dt parameter then create a constant (setting a value in that constant)
  3. Make sure that works
  4. I supposed you create the local variable from a control so, let's modify the Representation right clicking the control then select Representation and select I64.
  5. The wire and local variable have to have color blue.

 

What I was thinking is that you were using wrong number representation for the dt Parameter. See the screenshot

 

Capture.PNG

 

Let me know if something changes    

0 Kudos
Message 10 of 13
(4,066 Views)