Cycle time (by Fernan from Philippines)
8/25/09
Hi there! Me Again!
I would like to ask, how past in milliseconds (ms) does a PIC cpu perform a scan time on every rung. crystal is 20mhz?
How many rungs can a PIC mcu accomudate? Before it fails to read?
Thanks! More Power!
(no subject) (by Jonathan Westhues)
Some instructions take longer to execute than others. For example, contacts and coils are very fast, but a multiply or a divide is slow. So it's not possible to say exactly how long a rung takes to execute.
The cycle time in LDmicro is always user specified (Settings -> MCU Parameters). If you make the cycle time longer, then you can execute more rungs within that time. LDmicro won't warn you if your program takes longer to execute than the specified cycle time; your timing will just be wrong.
There's also a limit due to the processor flash size. LDmicro will warn you if you exceed that one.
With typical clocks speeds (~20 MHz) and cycle times (~10 ms), tens or hundreds of instructions should be no problem. If you do have trouble, then try increasing the cycle time.
(no subject) (by David R)
Hi just to add to this,
If I am trying to do fast scan times I test the speed
of the program by connecting An output coil to a contact (negated) and let it pulse. I then connect me scope to the output and time the pulse, Increase the cycle time until the pulse does not happen any quicker and that is full speed.
After that set the cycle time A bit longer and every thing works well.
Regards
David