C++ compiler for Siemens PLC

A

Thread Starter

Andy

I need to convert my C++ code into S7 for siemens s7-300. I just want to reuse my code so I need a C++ compiler which which takes the c++ code and converts it into Step 7. Any ideas?
 
K

Ken Emmons Jr.

It would depend a lot on your OS even if one is available. PLCs don't do multithreading, all programs are scanned sequentially, no round robin
scheduling, etc. So there are more issues than just compiling.

If your code is simple enough you may be able to convert your C++ code to a structured text language which Siemens supports, but again, it
executes structured text differently than the way a computer would execute the same code.

~Ken
 
C

Curt Wuollet

Unless your C++ code is very limited in scope and is suitable for parallel execution, etc, etc. this isn't very promising. However, if you can back up and express your program logic in pseudocode that can be split into rung equations, you can convert your _program_ to run on the S7 stuff. After all, only the last step in programming involves coding in a particular language. IL being pretty similar to assembler, you might try compiling the less obvious bits and look at the object code. My guess is that it would be just as easy to reimplement in your choice or a combination of the S7 language offerings. Don't worry though, Siemens provides the facilities to make your code every bit as confusing and obfusticated as under C++.

Regards
cww
 
V

Vladimir E. Zyubin

Hello automation,

1. To use C++ for control algorithms is not good idea.

2. AFAIK, S7 is a close system (there is no oppinion to program it in a system language, e.g. C language), so Siemens' clones of the IEC
61131-3 languages are the only possibility to produce an executable code. So, again, to use the IEC61131-3 languages as a portable level
is a bad idea (simply, there is no way to convert a C++ program into the languages).

Constructive idea:
To produce "reusable program" try to find other PLC at least (e.g., there is a plenty of controller with JM inside it on the shelf).

--
Best regards,
Vladimir E. Zyubin
 
Not entirely true.

Check this out:
http://www.automation.siemens.com/doconweb/pdf/SINUMERIK_SIMODRIVE_04_2008_E/FBP.pdf?p=1

I haven't read it thoroughly, but it sure seems like you can put in C based code into the S7 plc ... as a matter of fact, the Sinumerik 840D CNC controller (which has a full S7 PLC embedded in it) contains a function block that is C encoded and cannot be viewed or opened (FB15) and it is only listed in the blocks folder when you go online.

Hope that helps.
 
M

Martin Zborovjan

To use/reuse the C program, you have pretty much 2 options:

1. Use a SoftPLC from Siemens: 6ES7671-0RC06-0YA0 SIMATIC WinAC RTX 2008, EL, for Win2000/XP+RTX

Or Allen-Bradley SoftLogix 5800 (prefered)

OR

2. Use PLC like B&R PLC2005 range which supports C code natively, but not C++ with classes.

As it been already told, the PC code and PLC code constructions are not interchable without alterations due to differences in code execution (scanning(PLC), Sequencial(PC)).

Cheers,
Martin
 
For using a nice version of C/C++, you might want to consider using a product line, like www.tern.com. The TERN series isn't as heavy duty on the outside, but it can be easily added. It is a very flexible product line, has much more I/O ability for the buck, and many choices for what you and me look for at times.

If you call them (570-758-0180), ask for Tom and tell them Ed Wells sent you.
 
Top