Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Optimizing scan engine I/O timing on cRIO

I am looking for a way to optimize the timing for a process (that doesn't involve me guessing).

 

I have a cRIO with the scan engine set to a 1ms interval and 10ms network publishing.

 

The process I am performing is as follows:

1)Write a voltage to an analog out (this is a control voltage for a driver)

2)Read a voltage from an analog in (this a response due to excitation from the driver)

3)Write 0 volts to the analog out (turns off the driver)

 

Right now I am doing the following in LabVIEW

1)write to analog out

2)wait 75ms

3)read analog in

4)turn off analog out

 

If I lower the wait below ~70ms, there is a chance that I will not see the response, but will see the signal as if the driver was not on.

I have tried using the "synchronize to scan engine" vi, but have not figure out how use it the right way.

The response to the excitation is on the order of <1ms so I don't have to worry about going too fast for the system.

 

Any suggestions?

0 Kudos
Message 1 of 3
(4,886 Views)

Hey Alexander,

       You should be able to accomplish this by synchronizing to the scan engine. The following articles may prove helpful in implementing this with your current code:

 

Using the NI Scan Engine (ETS, VxWorks, Windows)

http://zone.ni.com/reference/en-XX/help/371361H-01/lvioscanhelp/scan_engine/

 

Using NI CompactRIO Scan Mode with NI LabVIEW Software

http://zone.ni.com/devzone/cda/tut/p/id/7338

 

Hope this helps!

 

--Ryan S.

0 Kudos
Message 2 of 3
(4,878 Views)

Hi Alexander:

 

Sorry this response is kind of late but if you're still having trouble with this, I'd like to help you get it figured out.

 

If I correctly understand what you're trying to accomplish, you're trying to write an analog value, institute some amount of delay, read an analog back from the device, and write another value to the analog out to set it to a safe state.  The problem you're running into is that the wait seems to need to be quite a long time even though the response from the system should come back in under 1 ms.  Correct?

 

Given that this information is correct, you should be able to setup your code simply so that each step happens in a separate scan period.  As you have alluded to, the problem you're seeing might be a result of not properly synchronizing to the scan engine and I would be curious to see what you're trying now and help troubleshoot that.  In the mean time, synchronizing to the scan engine can be accomplished using the methods detailed in the links Ryan posted.  The easier method is to use a Timed Loop with the timing source configured to Synchronize to Scan Engine.  You could then use a state machine to go through the process you've described as quickly as possible.  Your other option is to use the Synchronize to Scan Engine VI in some kind of loop or sequence structure.  It works similarly to the Wait Until Next ms Multiple VI except it will use the Scan Engine rather than the system clock.

 

Let me know if this makes sense and where you currently stand on the problem.  Also, you mentioned the timing of the network publishing but that shouldn't affect this problem given that everything will happen locally and network publishing will only affect remote targets reading these values.

Alex Person
NI-RIO Product Support Engineer
National Instruments
0 Kudos
Message 3 of 3
(4,836 Views)