No announcement yet.

Do-more Sim

  • Filter
  • Time
  • Show
Clear All
new posts

  • Do-more Sim

    Is the Do-more Sim accurate in regard to the BRX counters/timers. I am wanting to use just regular timers and counters in the BRX. It works fine in the sim and I was just curious if the sim would be faster or more accurate since it's PC driven. I am not needing super fast counts.

  • #2
    The timer and counter instructions are identical implementations in hardware and the sim, so they behave the same. The only real difference is that the sim is both much faster and much slower than hardware, depending on whether Windows has tasked out or not. In practical terms you shouldn’t notice any meaningful difference.


    • #3
      The timer is technically a millisecond counter on both the Sim and the PLC. Every PLC scan, the accumulated time for that scan gets added to the millisecond resolution timer in the timer's .Acc member (e.g. T0.Acc). If your PLC logic is long and complex, the PLC scan time could be 2ms or more (this is less likely on a PC because the software implementation is running faster), but as BobO stated, if your PC "tasks out" of that thread to run some other application (say you have a bunch of apps running doing lots of work on your PC), then even on a PC, that .Acc value will "skip" a value if the PLC scan was 2ms.

      For example, when you have sub millisecond PLC scans, some scans the .Acc value will increment, some scans it won't. But if your PLC scan is 2ms or more, you will see the .Acc actually skip, e.g. jump from 10 (ms) to 12 (ms) for that one "long" scan.

      There are no hardware timers driving the TMR instructions. There ARE hardware timers in the BRX PLCs for super fast timing (microsecond resolution, not millisecond). Also, there is a hardware level microsecond DWORD counter accessible via the MATH instruction, called TICKus() on ALL Do-more platforms (205, Terminator, BRX, and Sim). We use that to profile instructions, e.g.
      MATH D0 "TICKus()"
      STRPRINT lots-o-stuff
      MATH D1 "TICKus() - D0"
      So D1 will be the duration of the STRPRINT lots-o-stuff in MICROseconds. This works on all Do-more platforms.

      For 99.999% of the time, the millisecond resolution TMR (and all the siblings/cousins like TMRA, and RAMPSOAK) works just fine controlling whatever you have (use BRX High Speed I/O for those applications where truly fast I/O - up to 250kHz - is needed).
      There are 10 kinds of people in this world, those who know binary, and those who do not.


      • #4
        OK, great! Thanks! That answers my questions.