05-02-2019 01:31 PM
Hey, thanks for that info. It all makes sense now. Yes both my sensors are connected to the same DATA card (NI USB 6343). I'll try that clock method what u told me and see what I can get. Is it OK if my pressure sensor DAQ assist is set to continuous samples instead of On demand? Will it affect my data then??
05-02-2019 01:32 PM
@Michael_78 wrote:
the shift register works but will grow in memory size until the application crashes! limit the number of times the loop can run, maybe a for loop instead of while loop to be safe.
Very true - several people had posts on the forum just today with this issue. I don't agree a For loop is the appropriate solution though - if running for a long time something like a Producer/Consumer
should be considered.
@Michael_78 wrote:
Wire the AI Sample Clock to the counter clock source, instead of OnboardClock.
It is 🙂 or perhaps inverted, I'm not sure which way you mean. But the snippet shows a shared clock with regular timing.
05-02-2019 01:35 PM
@JerryD4299 wrote:
Hey, thanks for that info. It all makes sense now. Yes both my sensors are connected to the same DATA card (NI USB 6343). I'll try that clock method what u told me and see what I can get. Is it OK if my pressure sensor DAQ assist is set to continuous samples instead of On demand? Will it affect my data then??
Set them both to be continuous, with the same timing and number of samples, but add the extra info to advanced timing tab as described a couple of posts back.
05-02-2019 01:38 PM
So if my encoder is reading in 2500 pulses per rev should I try to set my pressure sensor to read data at a rate of 2500 something. Coz I'm not sure that the DAQ assist for the Crank Angle has a box for samples to be read or something.
05-02-2019 01:44 PM
05-02-2019 01:46 PM
Ok budd, Ill try that and see what I can get. Thanks for the help. I knew I was doing something wrong.
05-02-2019 01:50 PM
I edited my post, i read the clock setup wrong- my brain assumed AI at the top and Counter at the bottom
As for the For loop, i meant this to be only for a quick test but safer, not in the final application. whichever way it is done care needs to be taken not to put gigasamples in the X-Y chart!
05-03-2019 07:37 AM - edited 05-03-2019 07:40 AM
I don't have LV 2017 or later to modify in place, but there's one small detail to address in the nice example from msg #6. When multiple tasks share a sample clock, it's important to make sure all the *derived* tasks start first and the master task starts last. Here, the Ctr task derives its timing from the AI task, so the code should be sequenced to make sure the Ctr task is started first and the AI task is started last. Below is an incomplete snippet showing one way to enforce this sequencing.
-Kevin P
05-03-2019 11:54 AM
Hey man, here is my updated VI. I went ahead and set the sample type to continuous for the Crank Angle DAQ assist, and also specified ai/sample clock under Advanced Trigger. Do u mind having a look and telling me if its right? I'm new to lab-view and my school gave me this project to begin with.
Thank you.
05-03-2019 12:18 PM
Simple answer: Looks like it should work now to me.
However, you removed the Stop button (probably because of my confusion due to overlapping wires in the previous image) and so now you can't choose to stop the loop. You should probably re-add a Stop button and connect it to the Stop inputs of both DAQ Assistants.
Once you're happy that it's working as you want, you can try implementing it in more "low-level" code using the DAQmx VIs, if you have the time. I'm sure I or others here can check your progress/final VI and if you want to do more complicated things with LabVIEW in the future then knowing how to avoid the Express VIs (particularly the DAQ Assistant) will be very helpful.
As a starting (but not finishing) point, you can try right clicking on the DAQ Assist nodes and choosing "Generate DAQmx Code". This will use scripting to create equivalent (but messier) code to what you have with the DAQ Assistants. You'll probably need to rearrange with respect to loops (you'll want both Reads to be in the same While loop, and only have one While loop (not nested, which is what is auto-generated when I tried it just now)), and you might want to move things around to tidy them up.