Multithreaded C++ into function blocks - PLCOpen

I work on all types of systems from embedded systems, PLCs, DCS systems, Windows and linux server applications.

There is a lot of overlap what you can do with each type of system but they're still good at different things.

There is no way you can port (as in recompile with some minor tweaks) an entire application from C/C++ to a PLC.

I suspect that if someone thinks you can move an embedded system to a PLC then the embedded system is not doing something that only embedded systems can do.

The advantage of a PLC is standardized hardware and it's easy to modify the program for client specific uses. It's also a lot easier to troubleshoot for other people. And you don't need to develop any hardware.

With an embedded system there is a lot of things you have to program yourself (or you need libraries for) that you don't even have to think about when using a PLC.

I don't know what the system is doing but I would guess that 75% of all code in the embedded system is not needed when moved to a PLC.

That said, you have much more fine grained control over an embedded system and you could so things that are simply not possible with a PLC. For instance if you are doing things that requires microseconds response times then a PLC is too slow.

In essence a PLC is an embedded system but you don't have access to the OS and you are not running any code on the bare hardware.

I think you need to get a consultant that takes a look at what the application is doing (the end product) and then tell you if it is possible to do it on a PLC and what you would need in hardware and how much work it would be to convert the software. Ideally someone who has experience with both embedded development and PLCs. In my experience they are not that common as most PLC guys has an electrical engineer background and not a software engineer background.
 
Last edited:
Oh, another thing to keep in mind is that your hardware costs are likely going to be a lot higher when using a PLC compared to your inhouse developed hardware.

In high volume applications, one reason to use an embedded system when a PLC could do the job is cost.
 
Hi Pete and thank you very much for your input.
The cost of PLC will be a strong argument against moving completely over.

Another argument I don't have enough knowledge of is the speed/resolution. You say if we need something in the microsecond range then embedded is better for the job. What is the response time in PLC ?

In relation to response time how is the support for motion ? How can motion work with a high response time in PLC ? Is motion mostly used by PLC or in embedded ?

kind regards
Einar
 
Hi Pete and thank you very much for your input.
The cost of PLC will be a strong argument against moving completely over.

Another argument I don't have enough knowledge of is the speed/resolution. You say if we need something in the microsecond range then embedded is better for the job. What is the response time in PLC ?

In relation to response time how is the support for motion ? How can motion work with a high response time in PLC ? Is motion mostly used by PLC or in embedded ?

kind regards
Einar


A few milliseconds is where PLCs are at typically, say 5-10 ms.

Motion is usually done with a motion controller and that is usually integrated in to the drive solution in some way. So it's the motion controller that controls the servo drives and the PLC talks to the motion controller.

You could do motion control in the PLC as well but then it's a lot more work and you can't do much better than a few ms resolution so it depends on the application. In a lot of cases people use servo drives and motion controllers because it what they know, when they could be using simple ac motors and inverters and do the motion control in the plc.

Larger PLC systems also connect to their I/O over some kind of bus and you have some latency there as well to consider.

Inner workings of a PLC is usually to read all I/O at the beginning of the program cycle, then run through the entire program and then repeat forever.

PS. Also keep in mind that PLC often have hardware modules for whatever you need. So things that you could do in software on an embedded system could usually be done with a module in a PLC.
 
Last edited:

Similar Topics

Hi, I have attached herewith one image which our programmer has been used in S7 1500 PLC. Now we need to use the same instructions in S7 1200 PLC...
Replies
4
Views
120
Im trying to create a level indicator for water Tank i have used the ADD function while the pump is on and level increasing everything works...
Replies
33
Views
1,032
Good morning crew! Ok my logic works but I am missing something. When the start button is pushed it should like the red light for 4sec then shut...
Replies
13
Views
422
Please see attached file. I need this program in Function Block form but I am totally lost on this. Any help would be appreciated. Thanks!
Replies
8
Views
297
The idea here is to provide for a brief rapid influx of message codes while preventing sequentially repeating the same message. i.e. if two...
Replies
23
Views
683
Back
Top Bottom