PDA

View Full Version : Diy plc


james13
September 12th, 2016, 08:49 AM
So I decided to build a very simple PLC to put all my knowledge into one fun project. The question I'd like to throw out there relates to the real time program updates. Does anyone know how they allow program changes with out stopping the process or altering the scan time?

I guess there's a few ways one could program the microcontroller but I'd like to learn what people know/think and weigh up the easier vs. the technically better options.

If you know of a link to other projects feel free to post them as well.

Thanks

mk42
September 13th, 2016, 06:49 AM
In a Siemens PLC, I think they store the new code in memory while it is being downloaded, and the old code continues executing. When the scan finishes, it switches the calls to point to the new version of the code and delets the old version. Then it starts back at the new beginning.

jdbrandt
September 13th, 2016, 07:14 AM
So I decided to build a very simple PLC to put all my knowledge into one fun project. The question I'd like to throw out there relates to the real time program updates. Does anyone know how they allow program changes with out stopping the process or altering the scan time?

I guess there's a few ways one could program the microcontroller but I'd like to learn what people know/think and weigh up the easier vs. the technically better options.

If you know of a link to other projects feel free to post them as well.

Thanks

Well, honestly, aside from the original reply (which sounds familiar), I really don't know how they do it. But, I can tell you that in the Early Days, OnLine program changes was one of the Really Big Things that was introduced that really made these PLC things a usable tool. I do remember when I came out, and I thought "this just doesn't get any cooler....what will they come up with next - a way to store the program on something other than cassette tapes (!)"

JesperMP
September 13th, 2016, 07:54 AM
In a Siemens PLC, I think they store the new code in memory while it is being downloaded, and the old code continues executing. When the scan finishes, it switches the calls to point to the new version of the code and delets the old version. Then it starts back at the new beginning.That is exactly how it works in a Siemens PLC.
So new code and data can be downloaded while the old code is running, and the scantime is unaffected. even when the execution switches over from old code to new code.

But I think it is not totally trivial to implement.
The difficult bit is how to handle what the code must do if data declarations are changed.