Author Topic: DigIn max frequency/response time  (Read 3802 times)

Offline spittet

  • PLUS+1 Guru
  • *****
  • Posts: 117
  • Karma: +6/-1
DigIn max frequency/response time
« on: January 17, 2014, 03:08:52 PM »
Hi,

I'm using pin C1p49 of a MC088 to read the pulses from a prox sensor. I'm using the Measure Period function block to calculate the time between each pulse. I'm using the DigIn boolean signal from the C1p49 input pin. The minimal time between each pulse that the program will ever see is around 30-35 ms. To me, it's not that fast (about 33 Hz) and I think it should be good but I would lke a confirmation.

Does the DigIn of the C1p49 pin is fast enough for this?

I know it would have been better to use a FreqIn pin, but they are all used for other functions.

I looked into the API spec of the MC088 but I cannot find anything about the response time of the DigIn pins.

Let me know if you have an answer for this.

Thanks in advance!

Sam

Offline oiltronic

  • PLUS+1 Guru
  • *****
  • Posts: 170
  • Karma: +15/-0
Re: DigIn max frequency/response time
« Reply #1 on: January 25, 2014, 02:08:12 AM »
In this case I don't think it's a function of pin speed but your program's processing time (loop time) .  When you use the Measure Period component I would expect that the state of the input and the resulting period measurement will be checked once per program loop.

So when a single input transition occurs it may still be latched with hardware but I don't think it is dealt with until the next time the loop comes around to that particular Measure Period component.  Thus the worst-case impact on accuracy will be the maximum loop time.  If the loop time is say 3msec and each period around 30msec then your measurement will be +/- 10%.  And if the loop time is greater than the shortest expected period, then pulses will get missed.

You can use the Service Tool to check the loop time.  Also see OS.ExecTime in the API doc (search for "ExecTime").
« Last Edit: January 25, 2014, 06:45:22 AM by oiltronic »

Offline spittet

  • PLUS+1 Guru
  • *****
  • Posts: 117
  • Karma: +6/-1
Re: DigIn max frequency/response time
« Reply #2 on: January 28, 2014, 03:48:43 PM »
Hi,

Thanks for that answer.

I was able to move/reposition some pins so that this sensor is now on a MFin pin (C1p18). I'm now using the Period signal from the MFin pin and I gained a lot of accuracy/precision. Signal is more stable and I do not have the original problem anymore.

Thanks again!

Sam