News:

  • September 29, 2026, 08:53:02 PM

Login with username, password and session length

Author Topic: instruction Execution Times  (Read 26575 times)

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
instruction Execution Times
« on: January 17, 2019, 09:59:37 AM »
Is there a list of instruction execution times? Looked in the manual and help and could not find anything.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: instruction Execution Times
« Reply #1 on: January 17, 2019, 10:23:43 AM »
It's not that simple. Many things affect execution time.

You can figure it out yourself easily though. Use TICKus() in a MATH before and after the instruction. Unless you are talking about contacts, and they are very fast.
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #2 on: January 17, 2019, 10:40:07 AM »
Two things
Current program trying to make it run as fast as possible. Basic algorithm will be repeated 64 times. If I can shave time, it makes a big difference. Already using stages and separate tasks to get the bare bones logic running when needed.  Need to get a feel for if its worth the extra effort to write logic to avoid using indexed variables, straight out multiple timers versus one timer and comparative contacts. That kind of thing.

Also going to be using interrupts in an upcoming project and literately counting microseconds.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: instruction Execution Times
« Reply #3 on: January 17, 2019, 10:43:04 AM »
Best thing to do is to insert TICKus calls in the code around sections. Works very well for profiling.

How fast are you wanting your interrupts to fire?
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #4 on: January 17, 2019, 10:57:06 AM »
I have a 16.66 ms window, from the time of the  input to get the calculations done and set the output before the next interrupt occurs. Repeatability under a millisecond  is what I am trying to achieve, so I need to know what all that latency is. I see you have that in the interrupt structure available, which is great. Just trying to decide on the most efficient way to do it. I hope that is achievable.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: instruction Execution Times
« Reply #5 on: January 17, 2019, 11:12:27 AM »
Latency is one of the fields. For a single interrupt, it runs about 6-7us. If you have more than one interrupt, latency can obviously increase to the full execution of the other interrupt(s).
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #6 on: January 17, 2019, 11:24:42 AM »
I see you can have 32 interrupt routines, but in the configuration, only 4 tied to inputs? On the large BRX, you have 10 HS inputs, but still only limited to 4 interrupts tied to those inputs?
« Last Edit: January 17, 2019, 11:29:16 AM by ATU »

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: instruction Execution Times
« Reply #7 on: January 17, 2019, 11:27:49 AM »
32 ISRs. Onboard there are 12 interrupt generators (4 timers, 4 events, and 4 match regs) and those generators can be reconfigured via INCONFIG (even inside an interrupt).

The BX-HSIO will add 12 additional interrupt generators per module.
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #8 on: January 17, 2019, 11:29:42 AM »
If I used an  Interrupt Timer and scan the HS inputs? How close would that get me? Could I interrupt it every 500us and the PLC still function if the main program was small and coms kept to a minimim?
« Last Edit: January 17, 2019, 11:33:27 AM by ATU »

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: instruction Execution Times
« Reply #9 on: January 17, 2019, 11:34:38 AM »
If I used an  Interrupt Timer and scan the HS inputs? How close would that get me?

You can have all 10 HS inputs drive a single interrupt.

You can also do a fast timer. I'd use the event though.
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #10 on: January 17, 2019, 11:56:49 AM »
You can have all 10 HS inputs drive a single interrupt.

I overlooked that little detail. I see how to do it now.  Should work great. You guys think of everything.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: instruction Execution Times
« Reply #11 on: January 17, 2019, 12:20:24 PM »
I overlooked that little detail. I see how to do it now.  Should work great. You guys think of everything.

You're not the first. Most people come with the simplified view of a one-to-one relationship with a pin and an interrupt, and although our implementation is far more capable, they don't see what they expect and get off track. The struggle is real. ::)
"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

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #12 on: January 17, 2019, 01:34:39 PM »
Exactly,that was my only experience with interrupts. One input, one interrupt routine for on, maybe one for off. Going through your event configuration, you have a wide variety of conditions to utilize. Lots of possibilities.

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #13 on: January 23, 2019, 09:59:19 AM »
Best thing to do is to insert TICKus calls in the code around sections. Works very well for profiling.

Good Tool!

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: instruction Execution Times
« Reply #14 on: February 06, 2019, 05:03:31 PM »
Those interrupts are just freaking amazing. I never thought the day would come that you would be able to effect control within 50 microseconds on a PLC costing under $400.  Thanks for having the latency and execution time values. Big Help. Good job.