Author Topic: Interrupt Programming  (Read 6221 times)

benb2000

  • Jr. Member
  • Posts: 56
  • I love YaBB 1G - SP1!
    • View Profile
Interrupt Programming
« on: August 06, 2004, 09:00:39 AM »
I would like to connect a Quadrature encoder to a T100MD-888+,  say 128 PPR,  to HSC[1] and also feed one of the A or B signals into pin #5 as Interrupt Channel #3. This would allow me to synchronize reading A/D signals to every ( maybe ) rising pulse of the encoder.

The ISR ( Interrupt service routine ) would read 4 analog channels, and the value of HSC[1], do some processing, and then display the results on an LCD.

From an earlier discussion on timing, the moderator said

"The minimum scan time of the PLC is therefore = logic scan time (approx. 10us per word) plus I/o scan time (minimum 2ms)."

So if a program was say 1600 words long, I would expect a total period for one interrupt at 1600 x 10 us + 2 ms = to about 18 ms.

This would give me a maximum of say 50 interrupts per second.

What happens when the PLC see's incoming Interrupt pulses at a rate greater than 50 hz?

Is the interrupt input disabled when the ISR is processing, ( non retrigerable one shot equivalent ) and then re enabled when the routine is complete?

In other words, if the Interrupt is coming in at 150 Hz, will we still see a 50 hz. throughput, or will some error occur, and halt the PLC?

Your assistance is appreciated

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re:Interrupt Programming
« Reply #1 on: August 09, 2004, 11:55:33 AM »
Interrupt latency is not affected by the normal length of the ladder+BASIC program. However, the interrupt routine execution time itself will have an impact on how many interrupts can happen per second.

i.e. the length of the custom function that services the interrupt when it occurs will have the most impact on how many interrupts it can happen per second. If it takes longer to execute the interrupt service custom function than the period of the interrupt inputs (because of high speed encoder) than some of the interrupt cycles will be lost. If it only means that some of the analog data you want to capture will not be captured in those lost interrupt edges it probably shouldn't have much of an impact. But if you are counting some event then lost interrupt cycles can impact the accuracy of what you are trying to do.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

benb2000

  • Jr. Member
  • Posts: 56
  • I love YaBB 1G - SP1!
    • View Profile
Re:Interrupt Programming
« Reply #2 on: August 11, 2004, 07:13:39 AM »
Thankyou for the info.