News:

  • August 15, 2026, 08:24:28 AM

Login with username, password and session length

Author Topic: High speed counters on a BX-DM1E-36ER3-D  (Read 15482 times)

EDurako

  • Sr. Member
  • ****
  • Posts: 52
High speed counters on a BX-DM1E-36ER3-D
« on: September 04, 2019, 01:15:25 PM »
Hello,

Looking to implement a BX-DM1E-36ER3-D. I know that this unit supports up to 3 high speed counters (at a slower refresh rate than the HSIO).

Is there a eloquent way to have one of these timers pull double duty?

I have 4 flow meters. Only a combination of 2 of those 4 flow meters can be on simultaneously. So I really only need to run 2 high speed counters at the same time.

I'm sure I'm just missing it, otherwise there would be no reason to have 10 high-speed inputs on this PLC if only 3 could be used.

Please help, this is my first high speed input application.

Garyhlucas

  • Hero Member
  • *****
  • Posts: 421
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #1 on: September 04, 2019, 02:35:03 PM »
I too needed to collect data from 4 flow meters. Ours are Seametrics and the maximum pulse rate is only 550 Hz, just a bit too fast for a regular counter. So I read the high speed input using an interrupt and divided the count by 10 in the interrupt service routine. Then fed that pulse to a standard counter. Works great for us. First time I used an interrupt in a PLC!

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #2 on: September 04, 2019, 04:17:23 PM »
I'm sure I'm just missing it, otherwise there would be no reason to have 10 high-speed inputs on this PLC if only 3 could be used.

There are 10 fast inputs. Fast inputs can be used for high speed counter/timers, as well as interrupt triggers and immediate I/O.

There are only 3 high speed counters because they consume critical FGPA resources, and having more would require removing other things.



"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #3 on: September 05, 2019, 09:39:27 AM »
I'm sure I'm just missing it, otherwise there would be no reason to have 10 high-speed inputs on this PLC if only 3 could be used.

There are 10 fast inputs. Fast inputs can be used for high speed counter/timers, as well as interrupt triggers and immediate I/O.

There are only 3 high speed counters because they consume critical FGPA resources, and having more would require removing other things.

So there is not a way to share a high speed counter between 2 inputs? Acknowledging the fact that if the logic is wrong I could find myself in a ton of hot water (see what I did there? the flow meters are for 185 degree water fill nozzles)

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #4 on: September 05, 2019, 10:57:47 AM »
So there is not a way to share a high speed counter between 2 inputs? Acknowledging the fact that if the logic is wrong I could find myself in a ton of hot water (see what I did there? the flow meters are for 185 degree water fill nozzles)

Lol. No, sorry.

How fast are the pulses?
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #5 on: September 05, 2019, 11:38:07 AM »
Man that is a real kick in the rear.

We pulse 100 times every 1.5 - 2 seconds ~ish

Would it be beneficial (to more than just me) to allow users to switch high speed counter inputs via the logic vs. plugging in and using a computer?

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #6 on: September 05, 2019, 01:22:01 PM »
Man that is a real kick in the rear.

We pulse 100 times every 1.5 - 2 seconds ~ish

Would it be beneficial (to more than just me) to allow users to switch high speed counter inputs via the logic vs. plugging in and using a computer?

You are trying to use that to hack around a resource limitation. That causes more trouble than benefit.

How wide are your pulses? Your rate is easily slow enough to do this with an interrupt, but depending on pulse width, you might be able to use normal counters.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3843
    • Host Engineering
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #7 on: September 05, 2019, 01:45:09 PM »
The BX-HSIO module can add more High Speed Counter/Timers as you need them.  Each one comes with 4 High Speed C/T.  You can have up to 8 BX-HSIO modules in a single BRX PLC, for up to 32 High Speed C/T per system (in addition to the 3 on-board the -36).

Realize these are hardware based counter/timers, not software based.  Hence, the resources necessary are hard coded (literally) in the modules and MPUs.

Another option: Since you need 4 High Speed Counters, use a -M (no I/O) or a -10 MPU, and one BX-HSIO module instead of a -36 MPU.

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #8 on: September 10, 2019, 06:20:41 AM »
fanji1- I was hoping to avoid the HSIO if possible, we have around 30 production lines that need this hardware upgrade from their previous Horner PLC's and I also need 20 inputs/20 outputs so I was trying to keep my budget down.

BobO, can you provide an interrupt coding example? I'm reading up on those now, I have never used one. I am also not sure what you mean by pulse width, nor am I sure how I can even try and measure it.


BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #9 on: September 10, 2019, 07:20:00 AM »
BobO, can you provide an interrupt coding example? I'm reading up on those now, I have never used one. I am also not sure what you mean by pulse width, nor am I sure how I can even try and measure it.

You said you have 100 pulses every 1.5 to 2 seconds, but what is the pulse frequency and duty cycle? If that is constant pulses of 50% duty cycle, then your pulses are 15-20ms (50-66hz) and on for half of that time. But it is also possible that the pulses come at 15-20ms but are narrow, say 100us wide. Or you could be getting burst of 100 pulses every 1.5-2 seconds, but the frequency is 2khz.

I need to know what the actual pulse train looks like before I can make a recommendation. You would get that from either the source documentation of the device generating the pulses, or connect an oscilloscope to the machine and watch the pulse train.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

EDurako

  • Sr. Member
  • ****
  • Posts: 52
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #10 on: September 13, 2019, 09:35:07 AM »
You said you have 100 pulses every 1.5 to 2 seconds, but what is the pulse frequency and duty cycle? If that is constant pulses of 50% duty cycle, then your pulses are 15-20ms (50-66hz) and on for half of that time. But it is also possible that the pulses come at 15-20ms but are narrow, say 100us wide. Or you could be getting burst of 100 pulses every 1.5-2 seconds, but the frequency is 2khz.

I need to know what the actual pulse train looks like before I can make a recommendation. You would get that from either the source documentation of the device generating the pulses, or connect an oscilloscope to the machine and watch the pulse train.

Per our current oscilloscope test, the worst case, pulses are on for 5ms and off for 2ms

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #11 on: September 13, 2019, 11:14:36 AM »
Per our current oscilloscope test, the worst case, pulses are on for 5ms and off for 2ms

Easy.

This can be done with a timed interrupt (HSIO tab). Create a recurrent 1ms timer. Use the attached code in the ISR. I also included a trend of the interrupt total time and latency. For me, it never goes above 60us, so the PLC will not notice this is running. You can use the SLOPE instruction from the main scan to convert the counter values into frequencies.


"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #12 on: September 13, 2019, 11:27:19 AM »
Great...I said HSIO tab...that's wrong. Interrupt tab.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6170
  • Yes Pinky, Do-more will control the world!
Re: High speed counters on a BX-DM1E-36ER3-D
« Reply #13 on: September 13, 2019, 11:29:02 AM »
And be sure to set the input filters to something faster. The default is 25hz, and you need to be at least 150hz.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO