Jump to content
  • 0

With USB-1808X and using DaqInScan() to read data from an encoder with digital input or a counter.


PhilipW

Question

If I use digital input (MccDaq.ChannelType.Digital16) I am able to read the output from an Turck encoder. The output looks like the following:

0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 0 0 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 1 0 0 ... 

The output is a square wave. The samples per channel per second is 2500. I wrote a method to count the pulses per second and the average pulse count is around 900.

If I use a counter (MccDaq.ChannelType.Ctr) to process the output from the Turck encoder and configure the counter as follows:

    MccDaq.CounterMode Mode = MccDaq.CounterMode.Totalize;
    MccDaq.CounterDebounceTime DebounceTime = MccDaq.CounterDebounceTime.DebounceNone;
    MccDaq.CounterDebounceMode DebounceMode = 0;
    MccDaq.CounterEdgeDetection EdgeDetection = MccDaq.CounterEdgeDetection.RisingEdge;
    MccDaq.CounterTickSize TickSize = 0;
    int MapCounter = 0;

    uLStat = daqBoard.CConfigScan(CounterNum, Mode, DebounceTime, DebounceMode, EdgeDetection, TickSize, MapCounter);
    
The output looks like the following:

0 1 1 1 3 4 5 5 5 6 7 8 8 8 10 11 12 12 12 12 14 15 15 15 16 17 18 19 19 20 21 22 22 22 23 24 25 26 26 26 28 29 29 29 30 31 32 32 32 34 35 36 36 36 36 38 39 ...

The samples per channel per second is also 2550. The average pulse count per second is around 3500.

Any idea why my pulse counts don't match?

In the encoder data, when a 1 follows a 0, is it a rising edge?

Regards,
Philip

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello Fausto,

Sorry I could not respond earlier. I had other commitments.

I've provided a sample application. I connected it to a USB-1808X. A Turck encoder is attached to the USB-1808X. The application can use the digital input or a counter. The application generates a text file which shows information.

Data is collected and processed each second. The samples per channel per second is 2500. Data is collected with DaqInScan().

If using digital input, the application counts the rising edges ("0" followed by "1") to determine the number of pulses per second.

I'm trying to show that using digital input or a counter will produce the same number of pulses per second.

See attached zip file.

Regards,
Philip

WpfAppEncoderPulses.zip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...