Author Topic: scan time problems  (Read 12999 times)

skj1402

  • Newbie
  • Posts: 28
  • The Innovator!
    • View Profile
scan time problems
« on: February 13, 2007, 03:08:33 AM »
I have a situation where I need to have the PLC to accurately count a pulse train at a max frequency of around 100hz but more typically at around 70hz (~14ms/cycle), and acting upon a each cycle to perform an operation when required.  Normally this wouldn't be too much of a problem for a very small program (I've tried it and it works) BUT the size of my program is around 6.3 Kb (near max capacity), so the PLC's scan time now becomes a problem insofar as pulses are being missed.
Using the HSC appears not to be an option as although this function can easily count at much higher speeds, it's the amount of time it takes for the HSCDEF function to perform it Cusf operation that again causes timing problems.
The only way I can think of overcoming this problem is to have a faster scan speed, so would overclocking be an option to explore? If not, do you have any other ideas? Thanks.
PS Are you planning to release a faster PLC soon with larger memory?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:scan time problems
« Reply #1 on: February 13, 2007, 04:12:39 AM »
Try configuring inputs 3,4,5 or 6 as interrupt inputs and have it triggered a custom function whenever there is a rising edge. This should work Unless your custom function is taking longer than the period of the pulses (why?). If your custom function is taking too long, is it because it has not be written optimally? If you are waiting for some response from a serial comm, writing to EEPROM etc then there is some delay in these operations and regardless of CPU speed it will not help if the delay is fixed.

There are newer PLC being planned, but not likely to be available soon enough to meet your need. At the moment we don't have a fixed target intro dates yet.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

skj1402

  • Newbie
  • Posts: 28
  • The Innovator!
    • View Profile
Re:scan time problems
« Reply #2 on: February 13, 2007, 05:14:59 AM »
I have actually thought of using an interupt for this function but like the HSCDEF function, which instigates the operation of a custom function when a count value is reached (in my case just a count of 1), the time it takes to perform the Cusf, counts are still missed, and I believe that would also be the case with using interupts.
I have tried the following:

Cusf#20
HSCPV[1]=0
HSCDEF 1,21,1
SETIO pulsein


Cusf#21
HSCPV[1]=0
HSCDEF 1,20,1
CLRIO pulsein

The 'pulsein' is a contact label which opens and closes providing the input for internal counters.  I've also used straightforward inputs to counters via the I/O ports to no avail. Can you see anything wrong with what I am doing or is this a problem that cannot be overcome due to the pulse speed versus the program size?  
Can the PLC also be overclocked as a possible way of speeding up the scan speed?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:scan time problems
« Reply #3 on: February 13, 2007, 06:12:13 AM »
I don't think the count is missed, rather the pulsein may not have enough time to propagate through the entire ladder program (long ladder scan time) before being changed by another transition on the HSC pin. It doesn't seem efficient to define a HSC target of 1 count from 0 and then trigger the interrupt service CF. Using the interrupt pin is much simpler. Inside the interrupt CF you can perform the work at those circuits that are controlled by "pulsein" contact instead of waiting for the ladder scan to reach the circuit later. That way it should bypass the scan time limitation.

Unfortunately, overclocking the CPU is not an option on the T100MD+ PLCs.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS