Microprocessor is sequential, plc's programmable


Thread Starter


A microprocessor is a sequential device, performing one instruiction after another in time. A plc is a programmable electronic replacement for a number of electrical circuits each of which would operate concurrently. given that a microprocessor is the heart of the plc can anyone tell me how the processor implements the actions of a plc?
A plc also processes the logic sequentially. A simplified plc scan is this. read inputs, solve logic, update outputs. The time it takes to do this is called the scan time and is roughly 5ms depending in the size of the program and the model used. If you used an embedded microprocessor in a system programmed in C or assembly then you could simulate a plc by programming it in the same fashion. read inputs and store to memory, solve program variables, update outputs. Again, all of this happens so fast it gives the appearance of concurrent processing but it really is not.

Daniel Chartier

This can only be a short answer; you can get lots more info on the net (try "www.plcs.net":http://www.plcs.net , for example). Basically, a PLC runs a cyclic scan of its process, split into different sections:

1) reading the values in the input image table (not the direct inputs, but registers that mirror tyhe values at the reading time); the actual inputs are voltages or currents of different values supported by electronic modules; the image table only cares about the logic state (1 or 0) of the different addresse in the PLC memory.

2) execution of the logic program, taking into acount the state of the input table read previously;

3) writing of the logic states in the output image table resulting from the programmed logic (this is then the values actually written to the actual outputs);

4) depending of the power of the PLC, a time allowed for communications, treatment of specialties modules (positionning, high-speed counting...)

5) a period for clean-up and data management for the processor.

This process is repeated continuously, as fast as possible, and does not require interrupts for user input/output: no keyboard entry, no video display, no mouse or floppy.

So you can see that in this context, it is (relatively) easy to plan a microprocessor program to deal with a PLC scan.

Hope this helps,
Daniel Chartier
A single processor can no more run truly concurrent instructions than a length of ethernet cable can carry multiple messages to and from the server concurrently. They just round robin everything fast enough so each user (or instruction rung) thinks it's on a private processor. With a PLC, typically the I/O's are updated at the end of the scan so they look like they're changed simulteneously as welll...

It doesn't try for the concurrent solution - these days it could without any trouble, but back when PLCs were invented there wasn't that much computing power available, so it just works sequentially.

People are used to it now, so if a new PLC did emulate the concurrency it would feel alien to people in the field.

Jiri Baum <[email protected]> http://www.csse.monash.edu.au/~jirib
MAT LinuxPLC project --- http://mat.sf.net --- Machine Automation Tools
Also to note:

You can alter the the "scan" in most PLC's with subroutines, imediate output writes, etc., but the basic scan is "canned" and checked by a watchdog timer. Therefore, there is a bit of inherent safety and load taken away from the end using programmer. This point can be considered good or bad depending on your point of view.