LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me speed up my program

Solved!
Go to solution
Solution
Accepted by topic author DarkMarc86

Ah, that isn't how I interpreted your applicaiton from the original post.  

 

The example I posted will only strobe each line with a configurable duration pulse (labelled "pulse width" in my example).  The maximum is just shy of 12 hours ((2^32-1)/(100 kHz)), but this still isn't really "indefinite" and you miss out on the resolution that you would have with using a faster timebase.

 

So... I would suggest instead to do this with a pause trigger, something like this:

 

CounterOutputSyncExample3.png

 

 

Best Regards,

John Passiak
Message 11 of 17
(1,222 Views)

@DarkMarc86 wrote:

Yes, I think I am using four different counters. Though I am confused as to why Labview thinks my system has at least 8 counters. The datasheet says the NI-9174 has four counters. My counter selection list has 'cDAQ1Mod1/ctr0:3' and 'cDAQ1/_ctr0:3'.

 


cDAQ1/_ctrN is the internal representation of cDAQ1Mod1/ctrN.  This allows you to use the counters without requiring a digital module, or in your case to use a counter output without generating the pulse on the module's output terminal (since we are only using the trigger to start the other counters on the backplane we don't need its output routed to the 9401 at all).  

 

 

Best Regards,

John Passiak
Message 12 of 17
(1,218 Views)

Hi John,

 

Thank you very much. I have taken the time to understand your program and it is very helpfull for me.

 

I now have one new problem. I need to add one more output channel. This channel will be the inverse of counter2. I am not sure if there is a simple function that will force a new channel to be the inverse of another channel in hardware (I don't want it to be in software becaus eof the tight timing requirements). I was thinking of adding a fourth counter to the 'counter array' but if I do this, I will have to use something else to trigger the initiation of the four hardware counters. Is it possible to use a software trigger or some sort of other mechanism to trigger the four counters simultaniously?

0 Kudos
Message 13 of 17
(1,179 Views)

You could use an external inverter.

 

If you want the inverted channel coming out of the DAQ card though, you should use the 4th counter.  Set the Idle State on this counter task to High instead of low.

 

To trigger without using a dedicated counter you have a few options:

 

1.  Use Freq Out to generate the trigger.  It behaves sort of like a counter but it only is capable of continuous pulse generation (therefore, the "wait until done" wouldn't apply anymore, you would just want a short wait to ensure at least one pulse has been generated).  You wouldn't have to change much from the original example to incorporate this.

 

2.  Trigger three of the counter outputs from the first one.

 

3.  Use an external trigger.

 

4.  Use an "external trigger", but connect it to a digital output line so you can control when the trigger is issued from your DAQ program.  This won't work since you are using 4 output lines for the counter outputs, and you need at least 1 input line to accept the trigger which wouldn't leave any available output lines on the 9401.  If you have a 2nd digital input or output module you could do this.

 

 

Best Regards,

John Passiak
Message 14 of 17
(1,137 Views)

Hi John,

 

Thanks for your advice. I really appreciate your help. I was able to implement the 'Freq out' pulses to trigger my counters and invert the idle state of one of the counters.

 

However, the requirements for my program have now changed and I now need an additional 'Arm' step/state. I have included an image below. The one second delay between 'arm' and 'start' does not have tight timing requirements so I am using software timing (ie. wait(ms).vi). Channels 3 and 4 control a high voltage switch (for safety purposes two signals need to be sent to it). When the 'Arm' button is pressed, I need these two channels to change state exactly as per my drawing. The issue now is that their idle states are opposite to their state during the delay. It is critical that after a reset that CH3 defaults to a 'high' state and CH4 to a 'low' state.

 

I've spent the whole day trying to incorporate this new functionality with no success. I've tried to use with the 'pause' funcion but I don't think it can help in this scenario. I've also tried halting the counter tasks, after the delays have occured, and creating a 'digital out' task to regain control of the output pins on my NI 9401 module. Unfortaunately, as soon as I halt the counter tasks, the pins revert back to their 'idle' state. If I change the idle states to the ones I desire, then I can't create the delays for CH3 and CH4.

 

Is there any other method that I could use to achieve what I want, or have my program requirements exceeded the limitations of the hardware I have?

 

By the way, I have a second 9401 module that I can use, though I was hoping to avoid that because we bought it as a spare in case we damange the current one.

 

REFCL control program design.jpg

0 Kudos
Message 15 of 17
(1,111 Views)

From your image, nothing different happens to the output once the start trigger is received.  Could you instead make the "arm" signal your start trigger and just add 1 second to the initial delay of each counter?  The counter will remain at its idle state during the initial delay.

 

 

Best Regards,

John Passiak
Message 16 of 17
(1,097 Views)

John,

 

The requirements for my program changed and I only needed to produce short pulses instead of permanently inverting the state of the counter, which has made things much simpler and I was able to implement your VI exactly. Thank you very much!

0 Kudos
Message 17 of 17
(1,067 Views)