Manual multicon function blocks and projecting instructions for Siemens S7 Firmware version 1.00 and up S7 Projecting instructions with explanations on function blocks for integration of multicon spindle position displays in PLC Siemens S7 via Profibus interface of Baumer gateway GK473 Baumer IVO GmbH & Co. KG Dauchinger Strasse 58-62 DE-78056 Villingen-Schwenningen Phone +49 (0)7720 942-0 Fax +49 (0)7720 942-900 info.de@baumerivo.com www.baumer.com 05.11 · 174.02.
Contents 1. Overview 4 2. Gateway Settings 5 3. Simatic Manager (Step7 Software) 5 3.1 Creating a new project 5 3.2 Import GSD file 11 3.3 Hardware-Configuration 11 3.4 Parameterization 13 3.5 Store, compile and load 15 3.6 Organization block OB1 15 3.7 Organization block OB82 17 3.8 Organization block OB86 18 3.9 Troubleshooting 20 3.10 Evaluating the diagnostic data 20 3.11 Remanent profile storing 21 3.12 Creating an AWL-(STL Statement List) source file 21 3.
Registered Trademark SIEMENS, Step7 and S7 are registered trademarks of Siemens AG. These and other names applied in the present manual that at the same time are registered trademarks are not especially highlighted. Having omitted a specific mark does not necessarily imply that the names are unregistered trademarks or existing patents and protected patented designs. Disclaimer of liability The present manual was compiled with utmost care, errors and omissions reserved. For this reason Baumer IVO GmbH & Co.
1. Overview Part number Z 150.
2. Gateway Settings As described in the GK473 manual, set the Node ID in the gateway to an ID of your choice between 04 and 99. In the following example it is „42“. If the gateway is either the only DP slave or the last DP slave in the Profibus line, the Bus terminator is activated by setting both DIP switches to ON. In any other case set both DIP switches to OFF. 3. Simatic Manager (Step7 Software) 3.1 Creating a new project Open Simatic-Manager (Step7 Software).
Select your CPU type. Another option is entering an individual CPU name. Click on “next”. When selecting the blocks to be implemented chose OB1, OB82 and OB86. Select “AWL” (STL, Statement List) as language for the chosen blocks. Manual_GK473_S7_Profibus_EN.doc 04.05.11 6/32 Baumer IVO GmbH & Co.
Enter a project name of your choice (for example GK473) and click to „Finish“. Now the project window showing the already implemented blocks will open. You have to implement further blocks for the project. Select “paste“ -S7 block- and then the appropriate option. Manual_GK473_S7_Profibus_EN.doc 04.05.11 7/32 Baumer IVO GmbH & Co.
Install all the blocks shown above in successive order. In the following you will find further screenshots for both data blocks and a chart of variables (optional but recommended for testing purposes). DB10 Manual_GK473_S7_Profibus_EN.doc 04.05.11 8/32 Baumer IVO GmbH & Co.
DB11 DB20 Manual_GK473_S7_Profibus_EN.doc 04.05.11 9/32 Baumer IVO GmbH & Co.
VAT1 After being defined in the SIMATIC Manager, loading of all data blocks into the S7 is imperative (select blocks, then system of destination Æload)! Otherwise it will not work (neither there will be an error message). Manual_GK473_S7_Profibus_EN.doc 04.05.11 10/32 Baumer IVO GmbH & Co.
3.2 Import GSD file Consider the left project window. Branch down to all project elements by clicking on the “+ “ sign. Click on SIMATIC 300 station. Among others, the right window will indicate „Hardware“. Double click on „Hardware“. The hardware window of the Simatic Manager as independent program element „HW config“ will open. When importing a GSD file no station in the hardware window must be left open. Make sure they are closed by clicking on „Station“ Æ „Close“.
I To enter default settings click on „OK“ Next step is connecting the gateway to Profibus. HW Config Æ Catalogue Æ other fieldbus devices Æ Gateway Æ GK473. Drag name „GK473“ to the dotted Bus rail using the left mouse key. The window „Properties DP-Slave” will open. Manual_GK473_S7_Profibus_EN.doc 04.05.11 12/32 Baumer IVO GmbH & Co.
In this window enter only the Node ID which has to be identical to that previously set at the gateway’s two rotary switches (Example: 42). Close window by click on OK . Drag module “16bit I/O” of GK473 from the hardware catalogue to the window „location /module“ in the left corner. Upon double click on the newly created line the window of module “16bit I/O” will reopen. Enter port addresses for input and output data. Different from the screenshot the example is using identifiers (addresses) 20 to 35. 3.
Click on index card „Parameterize“. Now define the gateway properties as required (see manual) by either double click on the respective line or by click on „change value“. Finally the connected peripheral devices have to be configurated. Use left mouse key and click on the corresponding block in the catalog window, dragging it to the place desired. The following screenshot is showing the status after configuration. Manual_GK473_S7_Profibus_EN.doc 04.05.11 14/32 Baumer IVO GmbH & Co.
3.5 Store, compile and load Select „Store and compile“ in HW config to load the hardware configuration into the PLC. This has to be done after ANY modification in the hardware configuration. 3.6 Organization block OB1 Create a master program as described in the following. After polling operation of the key for clearing the status-LEDs of OB82 and OB86 the program will consistently read according to label NOCL the 16 bytes input data into data block DB10 by help of function SFC14.
NOCL U SPBN L T NOP E 0.3 NOCL W#16#0 AW 4 0 CALL SFC 14 // Read input data to DB10 LADDR :=W#16#14 // E/A range of the gateways starts with 20d=14h RET_VAL:=MW10 // Status and error messages after memory word 10 RECORD :=P#DB10.DBX 0.0 BYTE 16 // Target is data block DB10, start byte 0, // Length 16 bytes CALL SFC 15 // Output of output data of DB11 LADDR :=W#16#14 // E/A range of the gateways starts with 20d=14h RECORD :=P#DB11.DBX 0.
3.7 Organization block OB82 Contrary to the name „Diagnostic alarm” OB82 "I/O Point Fault" is not effected upon DP-Slave alarm but upon „warnings“ (existing external diagnostic data, no static diagnosis). Incoming and outgoing events can be evaluated separately. Organization block OB82 not inserted in the project will make the PLC stop upon occurrence of such event. To prevent a PLC stop it is sufficient inserting OB82 without program code.
BEA KOMM: NOP // End current block 0 CALL "DPNRM_DG" REQ :=TRUE LADDR :=W#16#3FE // symbol SFC13 U SPB // Call memory bit M1.0 ; set VKE correspondingly // Repeat SFC13 // As long as VKE=1 (linked result) // Diagnostic address 1022=3FEh, // see Hardware Config Slave RET_VAL:=MW20 // any free memory word available RECORD :=P#DB20.DBX 0.0 BYTE 11 // Target is data block DB20, // Start byte 0, length 6+5=11 byte BUSY :=M1.0 // any memory bit used as Busy token; // Repeat as long as Busy 3.8 M 1.
GEHT: L L #OB86_EV_CLASS B#16#39 == SPB I KOMM NOP L T 0 W#16#FF AW 4 CALL "DPNRM_DG" REQ :=TRUE LADDR :=W#16#3FE // Event class and marks // Mark incoming event // (B#16#38 is outgoing event) // Identical? //Switch on LEDs of output component group // SFC13 // Diagnostic address 1022=3FEh, // see Hardware Config Slave RET_VAL :=MW20 // any free memory word available RECORD :=P#DB20.DBX 0.0 BYTE 11 // Target is data block DB20, // Start of byte 0, length 6+5=11bByte BUSY := M1.
3.9 Troubleshooting 3.10 Evaluating the diagnostic data Chapter 3.7 „Organization block OB82“ describes diagnostic data readout. For evaluating the diagnostic data stored in DB20 byte 11must be read off and compared to possible fault numbers. To do so, byte 11 is checked regarding coincidence with available fault numbers. Upon coincidence the program skips to the responsible troubleshooting mark. L DB20.DBB L 0 ==I SPB ENDE L DB20.DBB L 1 ==I SPB EFLA L DB20.DBB L 2 ==I SPB ERAM L DB20.
3.11 Remanent profile storing Data blocks may be defined as „ not process relevant“ (key word: UNLINKED) so that they are stored only in the remanent memory when being loaded into CPU. Thus they do not burden the CPU memory unnecessarily and the relevant data are only loaded if required. This procedure is especially recommended for profiles since they do not require frequent access due to the fact that a profile is not being altered very often.
By double click to the new AWL (STL) source file a window showing the function’s source code will open. Afterwards the source file is stored and the program returns to the SIMATIC manager. Now the project source file must be compiled. Use right mouse key and click to ÆCompile to AWL (STL)-source file ( in the following FC2) of the SIMATIC-Manager. 3.13 Transferring PLC commands to SPA by gateway As described in the GK473 manual, possible commands of gateway to SPA have basically the same structure.
3.14 Structure of profile data block DB98 Profile data block DB98 implies all profiles of each single SPA connected .The individual targets are written into the data block in successive order and each SPA is capable of memorizing up to 100 targets. When adapting this data block it has to be made sure that it is in line with function FC14. For example, the DB is not only for storing targets but also other data, or maybe only 15 profiles are required instead of 100.
4. Functions Important! Since it takes the SPA a little time to answer the calls some functions have to be called repeatedly. This is indicated by a „Busy“ message (Busy bit). It is up to the operator to have the OB functions repeated until the Busy bit is no longer active in order to make sure that the data being read in are truly the current ones and do not rely to a previous data call. ! 4.
4.2 The global variables, data block DB99 Since many functions are called off repeatedly and the variables defined in the local function blocks are valid for calling operations only they are stored in data block 99. This way they can be accessed any time. The chart below gives on overview on the stored variables. 4.3 Busy bit, Timeout bit and Error bit All functions awaiting an SPA reply will come with a Busy bit, Timeout bit and an Error bit.
4.4 FC 1 - ASCII Number (6 Byte) in real numbers This function is required by FC10, FC11, FC12 and FC13 to convert the SPA data received into a real number (with floating point according to IEEE-754). Incoming data in ASCII format are being read off a DB (in the example it is DB20) and converted to be depicted as real numbers with floating point. First the ASCII sign is converted into an integer number and multiplied by 10.
0 000 0 4 010 0 To achieve number 5 the first 4 bits are masked out using an UND link. 1111 is loaded into the battery and linked to 0100 0101 UND. UNDLinked to Result 010 0 000 0 000 0 010 1 111 1 010 1 To both numbers the ASCII offset is added what equals 0x34 and 0x35 that is written into the DB. 4.6 FC 10 – Read current value The function ”read current value” is reading the current value off the SPA addressed. The function is given the SPA identifier as integer number (1,2,3 ...).
4.7 FC 11 – Read target off current SPA profile This function is for reading off the current profile of the addressed SPA. The SPA identifier is passed to the function as integer number and returned is the target. The function runs identical to FC10, but instead of the current value being read in FC1 only the target being read in is converted. Call function: CALL FC 11 SPA_ID Time_Out Error Busy Target_Real Active_profile 4.
4.10 FC 14 – Read target off profile data block Of course the profiles can also be stored by PLC. This function is meant as example for a possible profile arrangement. Access is on DB98 where the SPA profiles (1-99) are listed. The pointer allows immediate access to a defined target. The function is given both SPA identifier and profile number in order to calculate the offset and to reply the target. Example: SPA-identifier = 4 Profile nr. =8 The function will now read the target off DB98.DBB 1228.
Positioning direction Counting direction Arrows Rounding the current value Turn display Offset Hide target Data_4_5 0/1 0/1 0/1/2/3 0/1 0/1 0/1/2/3 0/1/2 1..99 (UP/DOWN) (UP/DOWN) (UP/DOWN/UNI/OFF) (OFF/ON) (OFF/ON) (NORM/MAST/SLAV/WKZR) (OFF/ON/EVER) (SPA-Identifier) Call function CALL FC 16 SPA_identifier Positioning direction Counting direction Arrows Rounding the current value Turn display Offset Hide target Data_4_5 := INT; := BOOL; := BOOL; := INT; := BOOL; := BOOL; := INT; := INT; := INT; 4.
Call function CALL FC 18 Total_SPA Time_Out Error Busy := INT := BOOL := BOOL := BOOL 4.15 FC 19 – Collective information “Check Position” This function is for accomplishing the gateway function command „Check Position“. The command is processed in the same way as previously described. Same restrictions as for block processing do apply. Latter is not existing and has to be completed if required. Call function CALL FC 19 Number_not_in_posi Time_Out Error Busy := INT := BOOL := BOOL := BOOL 4.
5. Annex 5.