|Try our online PLC Simulator- FREE. Click here now to try it.|
Learn quickly with our PLC Training DVD Series: on sale
Click here now for details!
Now that we've seen how timers are created and used, let's learn a little about their precision. When we are creating a timer that lasts a few seconds, or more, we can typically not be very concerned about their precision because it's usually insignificant. However, when we're creating timers that have a duration in the millisecond (1ms= 1/1000 second) range we MUST be concerned about their precision.
There are general two types of errors when using a timer. The first is called an input error. The other is called an output error. The total error is the sum of both the input and output errors.
Below is a diagram illustrating the worst possible input error. You will note from it that the worst possible input error would be 1 complete scan time + 1 program execution time. Remember that a program execution time varies from program to program. (depends how many instructions are in the program!)
Shown below is a diagram illustrating the worst possible output error. You can see from it that the worst possible output error would be 1 complete scan time.
upon the above information we can now see that the total worst possible
timer error would be equal to:
What does this really mean? It means that even though most manufacturers currently have timers with 1ms increments they really shouldn't be used for durations less than a few milliseconds. This assumes that your scan time is 1ms. If your scan time is 5ms you had better not use a timer with a duration less than about 15ms. The point is however, just so that we will know what errors we can expect. If we know what error to expect, we can then think about whether this amount of error is acceptable for our application. In most applications this error is insignificant but in some high speed or very precise applications this error can be VERY significant.
We should also note that the above errors are only the "software errors". There is also a hardware input error as well as a hardware output error.
The hardware input error is caused by the time it takes for the plc to actually realize that the input is on when it scans its inputs. Typically this duration is about 10ms. This is because many PLCs require that an input should be physically on for a few scans before it determines its physically on. (to eliminate noise or "bouncing" inputs)
The hardware output error is caused by the time it takes from when the plc tells its output to physically turn on until the moment it actually does. Typically a transistor takes about 0.5ms whereas a mechanical relay takes about 10ms.
The error keeps on growing doesn't it! If it becomes too big for the application, consider using an external "hardware" timer.Learn quickly with our PLC Training DVD Series: on sale
Click here now for details!