Re: Thanks
luis said:
Thanks for your reply
There are various things I don't get so clear:
1.- The PLC have timers internally (software timers), I believe that they have a limited number off them (same for the counters).
Some have a limited nuimber, some don't. Often a timer isn't really a timer, but a type of counter. The PLC will have only one clock whose value changes constantly and independant of scan. When a timer isntruction is encountered, the value (or a peice of it) is compared to the last stored value, the accumulated value updated, the new clock time stored (plus the "extra" that didn't go into the accum), and the bits updated. In other PLCS, there may actually be seperate clocks running, which would be why you run out.
2.- In the tutorial they use Cxxx to name a counter or Txxx to a timer, this names refer to the IO/register the activated/deactived?
Keep in mind that the tutorial is based on no particular PLC. Some PLCs (such as AB) do use the 'T' or 'C' prefix to indicate a timer or counter, while others (such as GE and Modicon) do not. I find it a little easier to know that this register is being used for a timer because it has a 'T' in front, but that kind of data structure adds complications at times.
But to answer your question, these refer to INTERNAL MEMORY registers, not I/O registers. The PLC does not have a bunch of timers wired into its brain, any more than it has a bunch of relays with contacts. It was designed to replace all that junk. It's just computer memory now.
If this is true, then I can use the rrbb to refer to them also? (rrbb is rr=register bb=bit).
You are going to need more than just rrbb for a timer. At the very least, you'll need a register (word) to store the PRESET, another register (word) to store the ACCUMLATED, and at least one bit (for Done). But as I said, you might need at least a byte (half word) to keep track of the "how much time has passed since the timer block was last updated".
So you're trying to make "a PLC simulator", huh? That sounds like an overly ambitious project. How will this "simulator" differ from a Real PLC? How will you differentiate between the program that is the Simulator, and the program that the Simulator is running?