Author Topic: Can use 10KHz square pulse for intr input?  (Read 6489 times)

Hung

  • Newbie
  • Posts: 1
  • young engineer
    • View Profile
Can use 10KHz square pulse for intr input?
« on: June 23, 2002, 05:23:44 PM »
I have a question that relates to time period used by instructions of tmx100. How long is a TBASIC instruction?

My problem is scan 20 digital input in 10ms to realize the edge from OFF to ON of each input (like a custom counter)

Because the timers of m-series PLC only support to 0.01s resolution so I wonder that if I can use the PWM to creat a 10KHz square pulse and feed into an interupt input so that we can have a new timer with resolution of 0.1ms.

thanks for any advice.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re: Can use 10KHz square pulse for intr input?
« Reply #1 on: June 24, 2002, 12:56:45 PM »
TBASIC instruction execute from 100 to 500 us. It is not viable to use 10KHz interrupt to create your own timer.

The digital inputs are scanned automatically at every scan of the ladder logic scan and these are typically completed within 1ms to 5ms, depending on the length of your ladder program. You can determine whether an input has changed edge (off to ON or ON to OFF) by using the bit-wise exclusive OR operator ~ to test the INPUT[n] variable against a previously read variable at every scan of the program:

e.g. ?
         ?DM[10] = INPUT[1] ~ DM[20]
 ? ? ? ? ?IF DM[10] <> 0 ? ? ?' one of the inputs has changed.
 ? ? ? ? ? ? ? ? ....
 ? ? ? ? ?ELSE ? ? ? ? ? ? ? ? ? ? ? ' nothing has changed.
 ? ? ? ? ? ? ? ?.....
 ? ? ? ? ENDIF
 ? ? ? ? DM[20] = INPUT[1] ?' ?store current inputs for comparison in the next scan.
« Last Edit: December 31, 1969, 04:00:06 PM by -1 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS