Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter Operation Questions..

General Information:
Using PCI-6602 (Qty 3)
- Quadrature Encoders (12)
- Regular Pulses (12)
Programming in VB.NET

I have seen mention on forum that only 3 counters can use DMA at one time. How will this affect my operation if I want all 24 Counters counting at the same time?

Also, I know you can setup the Initial Angle in the CIChannels.CreateAngularEncoderChannel Function. Is there anyway to set this value to a new value later after some time has passed. Example, I am trying to establish a reference angle for a motor but the initial motor point may not be where I want the 0 to be. Also, can the same thing be done with CountEdgesChannel?

I am using all my Counter Channels for Counting Operations so I have n
o Counter Channel left for configuring my SampleClock for the Counters, is it possible to use an Analog (or Digital) Output from another PCI board (e.g. PCI6703 or PCI6509)?

Thanks.
0 Kudos
Message 1 of 4
(4,111 Views)
I can't speak to the VB.NET aspect of programming, but can hopefully help somewhat w.r.t. counter hw capabilities.

Q: ...only 3 counters can use DMA at one time. How will this affect my operation if I want all 24 Counters counting at the same time?

A: Only buffered measurements will want to use DMA. Pulse generation won't use it. Are you doing a buffered pos. measurement with all your encoders? If not, no problem but if so, the 4th encoder on each board will need to be explicitly configured to use interrupts instead of DMA, significantly limiting your acq speed. Comments around here suggest you may manage up to a few kHz, maybe less due to having 3 separate interrupt-driven encoder tasks.
Before you invest too much blood, toil, sweat, and tears, can you possibly add another 6602 to your PC? Or swap with another PC that has slot space?


Q: Also, I know you can setup the Initial Angle... Is there anyway to set this value to a new value later?... Also, can the same thing be done with CountEdgesChannel?

A: The hardware method would be to setup the encoders to use Z-channel indexing. Then an external pulse can reset the counter register to 0 or any other value you choose with hardware timing. However it can get tricky to get the proper phasing & timing when this external pulse is not the one inherent to the encoder. Also, this hardware method won't work for an edge counting task. Reply for more details...
The only software method I've gotten to work (at least under DAQmx) is to first stop the task, then assign a count value, then start the task up again, still using the original task id. I do it in LabVIEW so I'm afraid I don't know the syntax for VB.NET


Q: ...I have no Counter Channel left for configuring my SampleClock...

A: You can generally route a sample clock from some other DAQ board in your system provided you have a RTSI cable connecting the boards in your PC. However I don't think there is any such clock on the specific boards you mentioned (PCI-6703, PCI-6509).
Are any of your 12 pulse output channels suitable for use as a sample clock?

Good luck!

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 4
(4,111 Views)
Thanks Kevin P. I do have some follow up

Regarding the DMA limiting the amount of Counter Channels that can be read using buffered measurement, I do not think this will be a problem. Due to my application, I think I will have to almost continually read the position for certains values to respond/perform other functions from as soon as possible. Will there be a problem if just read single (instead of buffered) values from the board?

Regarding the setting the initial angle. I was able to get it to re-zero, by perform exactly what you mentioned, stopping and starting the task. I will have to try that for a non-zero point, but the idea seems to make sense.

None of my 12 pulse output channels are suitable for the clock. I am counting them to
verify the operation of a component I am testing. Would this clock signal need to be completely digital or could an analog signal generated (by a 6703 board) do the job. If not, would a M Series board with it's Counter/Timer be able to generate this clock signal?
0 Kudos
Message 3 of 4
(4,111 Views)
If you read your encoders as sw-timed unbuffered single point values, you won't be using any of the available DMA. The only (maybe) problem I see is that your 12 position values don't naturally correlate in time. If you need some decent timing info, you could query the msec tick count after each encoder read and use it as a timestamp. Just realize that the timing between reads will vary depending on when Windows decides to flush a disk cache, ping a network connection, redraw part of your screen, etc.

Your later question about a clock seems like a moot point if all your encoder reads are unbuffered. The clock would only be used for hw-timed buffered acquisition.
Nevertheless, you probably could toggle an analog signal betwe
en 0 and 5 volts to generate a functional "clock" pulse. Better yet, you could use a DIO bit from one of the 6602's to do the same. The advantage you gain is to force all 12 encoder positions to be clocked in simultaneously, guaranteeing them to be correlated in time. The time between reads will remain subject to the whims of Windows though.

An M series board could definitely generate a hw-timed clock signal. You wouldn't even necessarily have to use one of its counters if you'd rather reserve them as 2 additional quadrature encoder channels. For example: you could set up a continuous constant 0V analog output, send the voltage absolutely nowhere, but drive the encoder acquisition using the analog output clock as their sample clock. Or similar for timed digital i/o.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 4
(4,111 Views)