Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9870

Solved!
Go to solution

I am trying to use NI 9870 with a timed loop in the FPGA programming.  I have the output defined in the FPGA program and in the host program I am trying to read the data recived.  However, my host program is a timed loop with 3 ms loop timer.  I recently read that NI 9870 does not support Single Cycle Timed Loop (SCTLs) in the FPGA.  Is this true? is there any way around this ?

0 Kudos
Message 1 of 5
(6,792 Views)
Solution
Accepted by topic author Kamal_J.

Kamal

A SCTL on fpga forces the code to execute in one cycle so at 40Mhz this is 25nS.  not many modules support this mainly because of transfer of data to the module.  Your 8970 can easily support 3mS loop rate, just use a while loop and loop timer.  what I don't quite understand is you say the Host has a 3ms timed loop.  How are you transferring data to the FPGA?  I suggest perhaps a DMA, then the FPGA knows nothing of timing, it just sends data when it has something in the dma (-1 timeout on FPGA dma read, no loop timer needed)  On the 9870 think about the timeout settings in the module properties, and use an invoke node to check for CAN errors, without these your Write node could easily hang indefinitely if there are errors on the CAN bus.  In Example Finder there is a good example of sending data by polling FPGA controls which is also a good method.

I hope this helps,

Michael.

0 Kudos
Message 2 of 5
(6,775 Views)

Sorry!

My mistake, the 9870 is an RS232 module, my reply talks about the 9853 CAN module.  Most still applies though I think, except the error checking and timeout which are important for CAN not serial.

Michael.

0 Kudos
Message 3 of 5
(6,764 Views)

Thanks Michael.

 

Now I am running the NI 9870 in scan interface mode and the rest of the target project in FPGA mode.  But I can definitely run the serial communication at 3 ms, but it just seems to run late.

 

Thanks again !

0 Kudos
Message 4 of 5
(6,722 Views)

Have you benchmarked the GPS Data subVI to see how long it takes for that code to run? I'm sure that it runs faster than 3 ms, but benchmarking it would ensure this so we can narrow down the cause for the loop finishing late. I would also recommend looking through the following KnowledgeBase articles if you haven't already:

-Using 987x Serial Modules with CompactRIO

http://digital.ni.com/public.nsf/allkb/E6700473687BB0DA862578BE005116B0?OpenDocument

-Configuring the NI 987x Modules in Scan Mode

http://digital.ni.com/public.nsf/allkb/16989C708E5AF2C1862578A90067D9DC?OpenDocument

 

I'm sure you have looked through these references already but I wanted to make them available just in case. Also, how often does the loop finish late? Is it consistent and frequent or completely random?

dK
0 Kudos
Message 5 of 5
(6,661 Views)