24.01.2015 Views

PLC Programming

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Command File (cmdfile) Commands<br />

Import from a S5 Project File<br />

POUs can read from Siemens S5 program files (*.s5d). The code that it uses is MC5 Code that can be<br />

run by S5 SPS. In general, MC5 Code corresponds with the STEP5 Instruction List (without symbol<br />

names) with which the programmer is familiar. The S5D also contains the line comments from the<br />

STEP5 Instruction List. Since an S5D file contains only absolute addresses with no symbol names,<br />

CoDeSys searches for the symbol names among the current CoDeSys project variables. If none are<br />

found, the absolute address is left unchanged. Therefore, if you feel the symbol name is useful, import<br />

the SEQ file before the S5 file.<br />

You first select the S5D file in a standard Windows dialog box. Another box pops up which contains<br />

the list of POUs from which you can select. It is best to select all of them. You can also select to leave<br />

the POUs in the STEP5 IL language or to convert them to IL, LD or FBD.<br />

Symbol names will be used in place of absolute names as much as possible. If CoDeSys finds the<br />

instruction "U M12.0" during the import, it will search for a global variable set at memory location<br />

M12.0. The first declaration that fits this description will be taken and the instruction will be imported<br />

as "U-Name" instead of "U M12.0" (the name of the identifier for the memory location is M12.0).<br />

At times additional variables may be needed during an import or code conversion. These additional<br />

variables will be declared globally. For example, R_TRIG instances are needed to reproduce edgetriggered<br />

inputs (e.g., in a S5 counter).<br />

Converting S5 to IEC 61131-3<br />

If you select an IEC language as your target language for a STEP5 import, you must be aware that<br />

portions of your project cannot be converted into IEC 61131-3. If part of a S5 POU contains code that<br />

cannot be converted into IEC 61131-3, an error message will be generated and the critical portion of<br />

the original STEP5 IL code will be inserted as a comment in the IEC POU. You must then replace or<br />

rewrite this code. System commands that only function in a specific S5 CPU cannot be converted into<br />

IEC. The "STEP5 Core Command List" can be converted into IEC code with a click of a button despite<br />

the fact that STEP5 is enormously different in the way it is conceived.<br />

The core command list that can be converted to IEC 61131-3 contains all commands that can be<br />

converted to LD or FBD in a STEP5 programming system and also all commands that are allowed in a<br />

STEP5-PB (Program Block). In addition, of the STEP5 commands allowed only in IL or in FB's<br />

(function blocks), the commands that can be converted to IEC are primarily those that are available in<br />

every S5 CPU (e.g., absolute and conditional jumps, shift commands, etc.)<br />

The only exception or limitation for conversion is related to resetting timers which can be done in<br />

STEP5 but not normally in IEC 61131-3.<br />

The individual convertible commands:<br />

U, UN, O, ON, S, R, = with the following bit operands: I (inputs), O (outputs), M (memory locations), S (S<br />

memory locations), D (Data in data blocks)<br />

U, UN, O, ON with the following operands: T (Timer), C (Counter)<br />

S, R with the following operands: C<br />

SU, RU, P, PN with the following operands: E, A, M, D<br />

O, O(, U(, )<br />

L, T with the following operand ranges: E, A, M, D, T, C, P (Periphery) and operand sizes: B (byte), W (word),<br />

D (double word), L (left byte), R (right byte)<br />

L with the following constant formats: DH, KB, KF, KH, KM, KT, KZ, KY, KG, KC<br />

SI, SE, SA with the following operands: T<br />

ZV, ZR with the following operands: C<br />

+, -, X, : with the following operands: F (fixed point number), G (floating point number)<br />

+, - with the following operands: D (32 bit fixed point number)<br />

!=, >, =,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!