08-05-2013 01:03 PM
LV 2010
PXI 1040
EtherCAT 9144 (2)
Various modules.
I'm and old hand at LabVIEW, but I'm brand new (3 days now!) to EtherCAT, shared variabled, and the Scan Engine.
I've got configuration figured out. Now I need to plan the best way to sample the data into my program.
(I've already got a program doing 1000 things on the PXI, so I need to be time efficient).
I wrote a test program to read a single chassis (72 channels) in a timed loop.
The loop is using a 1 MHz clock with a counter of 100, that's 10 kHz.
I'm recording the duration of the loop and it comes out as 16 uSec. That's fine.
I take it that it takes that long to read 72 values from the Scen Engine into my program.
I'm also extracting the first channel (which has a Thermocouple connected) ,and counting the number of samples that are repeats, i.e. duplicate reads of a previous value.
Here's the code:
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-05-2013 01:44 PM
If I go the other direction, it seems to correspond:
750 uSec --> 195 loops
500 uSec --> 190 loops
400 uSec --> 188 loops (execution time rises to 15-19 uSec)
300 uSec --> 186 loops (execution time average is higher)
200 uSec --> "Cyclic Telegram size has been exceeded"
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-07-2013 04:44 PM
Hi
As you must know the for loop is going to iterate as many times the size array indicates, due to the indexed input, this may be related with the scan engine period, since that array is built in the timed loop, just a couple of questions:
08-07-2013 06:27 PM - edited 08-07-2013 06:27 PM
As you must know the for loop is going to iterate as many times the size array indicates, due to the indexed input,
--- Yes, that's 10,000 times. It's initialized at the far left with a constant array where 9999 and 71 are the last valid elements.
this may be related with the scan engine period, since that array is built in the timed loop.
--- No, it's not. The array is initialized to 10,000x72 and never changed (in size).
Does the size of the array at the input of the for loop varies with the scan engine period?
--- No, and there's no reason it should. The timed loop simply replaces elements in an already-initialized array.
What code runs at the false state?
--- In that case, the sample value has changed. I append the current sample count (the bottom shift reg) to the array of sample counts I'm building, and set the current sample count to 1.
The code at the right is simply looking for changes in value of the one channel, and counting samples that are identical.
Blog for (mostly LabVIEW) programmers: Tips And Tricks