Author Topic: T100MD2424+ counter question help!!  (Read 14557 times)

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
T100MD2424+ counter question help!!
« on: January 04, 2010, 03:25:12 PM »
I have an application where I count pulses from two photo cells (on two separate measuring wheels) with a T100MS2424 on a regular inputs with a standard counters (not HSC) It works well up to a certain speed but over that speed is losing counts. I have verified this using a frequency counter direct on the input line from the photocell.  I am using 2 channels for frequency measurement for another part of the machine so I don?t have 2 HSC channels to use to resolve it.

The question is: The counter is on a rung with the photocell input incrementing the counter. I do not have a special bit say .01 seconds to force the counter to be serviced. I have assumed that I don?t need one since the counter will be incremented whenever the input changes state.  Am I correct here?

I have thought of changing to the new F2424 board since it seems to have the ability to use 2 HSC and 2 frequency measurements on input at the same time. Is that correct? If I change to this board will the program run on the F25 from the older board? I see some input pin locations are different, but most else is the same.
Ideas will be appreciated. thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:T100MD2424+ counter question help!!
« Reply #1 on: January 05, 2010, 11:02:01 AM »
1) Regular counter works only if the incoming input changes is less than the program scan time and therefore is only good for low speed counting job.

2) You don't need the clock pulse to service the counter since the counter changes whenever its input condition changes from OFF to ON.

3) Since you are already using input #3 and #4 for HSC, you may try to use input #5 and #6 as interrupt inputs to increment/decrement your counter. Interrupt inputs are independent of the ladder logic scan time (but of course the ISR execution time matters) and are good for up to 500 Hz input

4) If you use the F-series PLCs, you could measure the pulse rate using the same HSC input.  That is correct. Your old program should work on the F-series PLC without much changes (except to read PULSEFREQUENCY from the same HSC input) and pin assignment for the HSC are slightly different than on the M-series.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #2 on: January 05, 2010, 01:21:45 PM »
Thanks for fast reply.

In my current application I do not use input 3 + 4 as HSC but as frequency measurement. I am not currently using inputs 5+6 so they are available for use.
 
I want to be sure I am correct:  If I am using 3+4 for frequency measurement, I can also use 5+6 input as separate (2 independent) HSC at the same time? I am concerned that HSC is only for quadrature device and not two independent counters. If I can use these counters, easier for me compared to interrupt.

Also of note: I am using both stepper controllers while all of this is going on so I hope no conflict of use.

Good to know new board can be used if needed.
Thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:T100MD2424+ counter question help!!
« Reply #3 on: January 05, 2010, 03:12:59 PM »
No, 5 & 6 can only be used as one single HSC channel which is not what I suggested. I was suggesting you define them as Interrupt inputs (interrupt 3 and 4) and use interrupt service routine and increment a variable as counter.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #4 on: January 05, 2010, 04:40:51 PM »
I have tried several ways to do as you suggested without success.
I would appreciate an example of a ladder that shows how intterputs are defined and used as such.

I have looked through the manuals, the website and the samples and found none.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:T100MD2424+ counter question help!!
« Reply #5 on: January 05, 2010, 08:41:09 PM »
If you run  a statement such as INTRDEF 3, 100, 1 once.

Then every time the input #5 (interrupt channel 3) goes from OFF to ON, custom function #100 is executed. If you put a variable there:

e.g.

C = C+1
IF C >= 1000 THEN
  ..
ENDIF

This creates a counter in variable C and counts up to 1000 then trigger some actions (you define what you want to do there).

Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #6 on: January 06, 2010, 08:38:06 AM »
I have set it up and can make the counter work as desired, thanks. So once the INTRDEF statement is executed once, from then on the input designated to trigger the input will execute separate from the ladder scan.

When testing it in the simulator, it increments the variable when I toggle the input just as if it is not triggered by an interrupt. The simulator does not show any difference in the simulator display for ladder input vs. interrupt input.

Is there any way to know it is set for interupts other than the open loop of just setting it and wondering if it has changed action?

Thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:T100MD2424+ counter question help!!
« Reply #7 on: January 07, 2010, 02:10:03 PM »
The Simulator doesn't simulate the interrupt input.

If you set up the interrupt then you should not use the ladder with the same input otherwise a transition may be counted twice, once by the interrupt and then by the ladder logic.

Without the ladder using the input and the counter is still counting in response to incoming pulses, you will know that interrupt input is functioning.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #8 on: January 07, 2010, 03:56:12 PM »
Sounds good to me. Thanks for your timley reply.

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #9 on: January 14, 2010, 12:37:33 PM »
An update. I implimented the interrupt driven counter and all is working well. In this machine two interups are implimented as simple counters in the ISR custom functions assoiacted with imput pins 5&6.

The question I have is about contention between the two interrups: if while channel 3 is running it's very short function, channel 4 goes hi, will the event be captured or will it be ignored while the first function is executing?

I am hoping that the interrupt is latched in some way while the first ISR is executing so it will be seen as soon as the first ISR has finished and can be acted upon.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:T100MD2424+ counter question help!!
« Reply #10 on: January 14, 2010, 02:24:17 PM »
Yes, the event are edge-captured and if there is an ISR being processed, the new event will be captured and the new ISR will be run when the current ISR has completed and returned from its processing routine.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #11 on: January 14, 2010, 03:28:24 PM »
Good to know. I have thought further on this and have yet another question:

If I have ISR 1 being executed, and the channel #4 interrupt is tripped and waiting for the associated ISR, and then  channel #4  goes low and hight again (another event) will it keep track of several un-serviced intruppts and service them in a FIFO fashion?

In fact this may be a rarity in this system, but it could happen.

I apprecate your input.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:T100MD2424+ counter question help!!
« Reply #12 on: January 14, 2010, 09:01:35 PM »
No, the interrupt events are not cumulative. So if the first ISR takes too long to execute and meanwhile the second interrupt signal occur multiple time, only one event is registered.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:T100MD2424+ counter question help!!
« Reply #13 on: January 15, 2010, 08:49:28 AM »
I understand. I asked it out of hope, but suspected it was as you verified. It appears that in my application I am getting all of the events so I should be fine.

Cheers and thanks.