Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6210 - how to divide down counter input for analog timing source

Hi all,

 

I've got a problem with my USB-6210 configuration.

I'm kind of new to DAQMX, thus I don't know how to handle this.

 

I've got a setup running, which uses CNT0 from the USB-6210 to read an encoder (A and B)

This Counter signal is used as the timing clock for reading two analog values. So I get two analog values each time the counter value changes.

 

This works fine till now.

 

Our new machine setup has a new very fine resolution encoder (now 1µm, it was 20µm) and is faster then the old one (nearly twice as fast).

 

That leads to problems, because the USB 6210 isn't fast enough to aquire analog values for each counter change.

 

My suggestion is to divide down the encoder signal by using the second (available) counter of the USB 6210.

 

As a result I would like to get the 2 analog values and the counter value each (lets say) 20µm.

 

Could someone point out what I have to do to get this running, please ?!?!

 

I attached my DAQ Handler as it is now. The missing VIs are:

1. a functional global containing the Command Queue

2. a functional global containing the Results Queue

3. an Errorhandler

 

the values recieved for init are stored as default values in the "setup values" control now.

 

Thanks in advance, best regards


Balze

 

0 Kudos
Message 1 of 7
(7,007 Views)

i doubt that it is possible to use the second counter, in that manner.

As fas as I understood you have a lot of events from your encoder, and you want only access every 10 of them. You want to use the second counter to count every ten steps and then trigger a signal. Am I right?

For that you would need pulse train generation for that you need 2 Counters. There are only two.

 

If you want a slower trigger signal, you might consider doing it in hardware.

Did you consider a  Flipflop device? http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29

0 Kudos
Message 2 of 7
(6,990 Views)

Johannes,

 

thank you for your answer.

 

Yes, you are right. That's what I'm going to do.

 

Additional hardware comes to my mind, but it's too complicated, because it has to meet requirements for industrial equipments.

 

I found another solution, but doesn't completly understand how it works.

 

I found the divider in the task settings. (I don't know the english description, because i've got a german Labview.)

Please have a look at the snippet.

 

DAQ_Handler_USB-6210_BD.png

 

I divide the encoder by 2, but still receive every step of the encoder.

I expected to only receive every second encoder count.  Very confusing.

 

Thanks a lot.

 

Best regards

 

Balze

0 Kudos
Message 3 of 7
(6,984 Views)

I think that's the CI.Prescaler property?  (google translate seems to think so anyway).  This property isn't supported on the 6210, it's likely returning an error but your error wire isn't connected so you might not have noticed if automatic error handling is turned off.

 

Anyway... there is a way to do what you are asking using the 2nd counter:

 

Assuming the encoder is always travelling in the same direction:

 

    1. Configure the 2nd counter as an angular encoder task with the following inputs to create channel:
      decoding type: X1
      z index phase: A High B High (this is what worked for me on X Series, might be different on 6210)
      z index value:  the desired interval between pulses
      z index enable:  TRUE
      units:  ticks
      initial angle:  depends on the delay you want before the first pulse (minimum is 2).
    2. Using a channel property node, set the Z Input Terminal to be the counter's own internal output.
    3. Make sure that A and B are set up such that the counter is always counting down with the intended direction of motion (you can swap the input terminals if you need to using a DAQmx channel property node).
    4. Using an export signal property node, set the Counter Output Event Behavior to "pulse".

 

The counter will start at some value, and count down until it reaches 0 at which point it will issue a pulse.  This pulse resets the counter back to the desired z index value, which begins the process all over again.

 

 

Best Regards,

John Passiak
Message 4 of 7
(6,947 Views)

You can do a similar trick to divide down a clock signal by configuring an edge count task and using the count reset feature instead of the z index (in case you need this to work when the encoder is moving in either direction--just use either the A or the B signal as the source for the edge count task).

 

 

Best Regards,

John Passiak
Message 5 of 7
(6,944 Views)

John,

 

thank you for your reply. I'm back from vacation now and will check if this works for me.

 

Well, the error out .... 🙂

Yes it's not connected. 😞

But I've got automatic error handling turned on and can't remeber getting an error.

 

By the way the "NI USB-621x User Manual" mentioned on page 8-36:

 

Prescaling allows the counter to count a signal that is faster than the maximum timebase of the counter. USB-621x devices offer 8X and 2X prescaling on each counter ...


Where did you get your information, that it's not supported?

 

Thanks a lot!

 

Best regards,

 

Balze

0 Kudos
Message 6 of 7
(6,911 Views)

Oh sorry about that--I'm not sure what I was thinking--the 621x does support 2x and 8x prescaling for the signal connected to the counter source (as per the user manual like you mentioned).  For an encoder task though, the counter's source terminal is not used so I don't believe prescaling would do anything (according to the documentation anyway).  Trying with a simulated device does confirm that no error is thrown when you configure prescaling on an encoder task.

 

Anyway, the suggestion in my previous post is probably still the direction you want to go.

 

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 7
(6,899 Views)