Date: File:PRO1_08E.1 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Digital Operations CMP ==I IN1 IN2 IW0 IW2 M0.0 Q 9.7 T4 S_ODT TV S Q BCD BI R I 0.7 I 0.5 S5T#35s Q8.5 MW0 QW12
Date: File:PRO1_08E.2 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Number Formats (16 Bits) BCD INTEGER BCD 2 8 = = = 8 = Sign (+) Sign (-) W#16#F = = 8+2 = 4 = = = ( ) = Negative Numbers INTEGER Positive Numbers W#16# PGCPU
Date: File:PRO1_08E.3 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Number Formats (32 Bits) Real No = +1,5 * = 0,75 DW#16# or +7.5 E = = = 8 = 296 Integer (32 Bit) = Sign of Real No e = Exponent (8 Bit) f = Mantissa (23 Bit) General Format of a Real Number = (Sign) (1.f) (2 e-127 ) Sign (+) BCD DINT REAL
Date: File:PRO1_08E.4 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Examples of Load Loading and Transferring Data (1) L +5//16-bit constant (Integer) L L#523123//32-bit constant (Double Integer) L B#16#EF//byte in hexadecimal form. L 2# //16-bit binary value L 3.14//32-bit constant (Real) MOVE EN IN OUT ENO MB5 5 FBD L+5 TMB5 STL MOVE EN OUT ENO MB5 LAD IN5
Date: File:PRO1_08E.5 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Loading and Transferring Data (2) : L W#16#CAFE L W#16#AFFE : XXXXXXXXCAFEAFFE Content of ACCU2 Content of ACCU1 Programm YYYYYYYY XXXXXXXX 0000CAFE
Date: File:PRO1_08E.6 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Loading and Transferring Data (3) MB MB1MB MB3MB2MB0MB1 Load L MB 0 Program T QD 4 QD 4 QW 4 QB 4 Transfer Contents of ACCU1 L MW 0 L MD 0 T QW 4 T QB 4
Date: File:PRO1_08E.7 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives S5 Counters in STEP 7 STL AI0.4 CUC5 AI0.5 CDC5 AI0.3 LC#20 SC5 AI0.7 RC5 LC5 TMW4 LCC5 TQW12 AC5 =Q8.3 LAD FBD Q I 0.4 I 0.5 CU I 0.7 C#20 S_CUD CD S I 0.3 PV R Q 8.3 CV CV_BCD MW 4 QW 12 C5 Q Q I 0.4 I 0.5 CU I 0.7 C#20 S_CUD CD SI 0.3 PV R Q 8.3 CV CV_BCD MW 4 QW 12 C5 = Q
Date: File:PRO1_08E.8 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Counters: Function Diagram CU CD S R Q Count
Date: File:PRO1_08E.9 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Counters: Bit Instructions STL AI 0.0 LC#20 SC5 AI 0.1 CUC5 AI 0.2 CDC5 AC5 = Q 4.0 LAD I 0.0C5 SC C#20 Network 1: C5 Network 2: I 0.1 CU Network 3: I 0.2C5 CD Network 4: C5Q 4.0 FBD SC C5 I 0.0 C#20CV CU C5 I 0.1 CD C5 I 0.2 = Q 4.0 C5
Date: File:PRO1_08E.10 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Exercise: Counting the Transported Parts (FC 18) V AI1AI2AO1AO2 AI2 AI1 -15V...+15V AI1 AI2 AO1 AO2 V DI I 0.0 I 0.1 I 0.2 I 0.3 I 0.4 I 0.5 I 0.6 I 0.7 DO AUTO / MANUAL System_ON Accept System MANUAL AUTO System_OFF Q Q Jog_RIGHT Jog_LEFT QW 12 / QW 6 ACTUAL number of parts
Date: File:PRO1_08E.11 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: ON Delay (SD) LAD T4 S_ODT TV S Q BCD BI R I 0.7 I 0.5 S5T#35s Q8.5 MW0 QW12 FBD S_ODT TV Q BI R I 0.7 I 0.5 S5T#35s MW0 QW12 T4 BCD = Q8.5 S STL AI 0.7 LS5T#35s SDT4 AI 0.5 RT4 LT4 TMW0 LCT4 TQW12 AT4 =Q8.5 Example RLO at S RLO at R Timer operation Q Time value: s <-- 0.1s <-- 1s <-- 10s < Data type “S5TIME”
Date: File:PRO1_08E.12 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: Time Formats for S5 Timers in STEP 7 Format for time specifications Timer cell in system data memory ACCU contents after “LC T...”ACCU contents after “L T...” Time base Time value (BCD code)Time baseTime value (Binary number)Time base Time value (BCD code)Time value (Binary number) XXXXXXXXXXXXXX
Date: File:PRO1_08E.13 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: Stored ON Delay (SS) STL AI 0.7 LS5T#35s SST4 AI 0.5 RT4 LT4 TMW0 LCT4 TQW12 AT4 =Q8.5 LAD T4 S_ODTS TV S Q BCD BI R I 0.7 I 0.5 S5T#35s Q8.5 MW0 QW12 FBD S_ODTS TV Q BI R I 0.7 I 0.5 S5T#35s MW0 QW12 T4 BCD = Q8.5 S Example RLO at S RLO at R Timer operation Q
Date: File:PRO1_08E.14 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: Pulse (SP) FBD S_PULSE TV Q BI R I 0.7 I 0.5 S5T#35s MW0 QW12 T4 BCD = Q8.5 S RLO at S RLO at R Timer operation Q Example STL AI 0.7 LS5T#35s SPT4 AI 0.5 RT4 LT4 TMW0 LCT4 TQW12 AT4 =Q8.5 MW0 LAD T4 S_PULSE TV S Q BCD BI R I 0.7 I 0.5 S5T#35s Q8.5 QW12
Date: File:PRO1_08E.15 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: Extended Pulse (SE) LAD T4 S_PEXT TV S Q BCD BI R I 0.7 I 0.5 S5T#35s Q8.5 MW0 QW12 FBD S_PEXT TV Q BI R I 0.7 I 0.5 S5T#35s MW0 QW12 T4 BCD = A8.5 S RLO at S RLO at R Timer Operation Q Example STL AI 0.7 LS5T#35s SET4 AI 0.5 RT4 LT4 TMW0 LCT4 TQW12 AT4 =Q8.5
Date: File:PRO1_08E.16 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: OFF Delay (SF) STL AI 0.7 LS5T#35s SFT4 AI 0.5 RT4 LT4 TMW0 LCT4 TQW12 AT4 =Q8.5 LAD T4 S_OFFDT TV S Q BCD BI R I 0.7 I 0.5 S5T#35s Q8.5 MW0 QW12 FBD S_OFFDT TV Q BI R I 0.7 I 0.5 S5T#35s MW0 QW12 T4 BCD = Q8.5 S Example RLO at S RLO at R Timer operation Q
Date: File:PRO1_08E.17 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Timers: Bit Instructions I 0.0T4 SD S5T#5s T4Q 8.0 I 0.1T4 R Network 1: Network 2: Network 3: LAD & SD T4 I 0.0 S5T#5s &= Q 8.0 T4 & I 0.1 TV R T4 FBD AI 0.0 LS5T#5s SDT4 AT4 = Q 8.0 AI 0.1 RT4 STL
Date: File:PRO1_08E.18 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Exercise: Monitoring of the Transport Functions (FC 17) V AI1AI2AO1AO2 AI2 AI1 -15V...+15V AI1 AI2 AO1 AO2 V DI I 0.0 I 0.1 I 0.2 I 0.3 I 0.4 I 0.5 I 0.6 I 0.7 DO AUTO / MANUAL System_ON Accept System MANUAL AUTO System_OFF Q Q Jog_RIGHT Jog_LEFT QW 12 / QW 6 ACTUAL number of parts Ack_Dist Disturbance Weight I 1.0
Date: File:PRO1_08E.19 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Conversion Operations BCD Integer IN BCD_I EN ENO OUT IN I W4 MW20 IN I_BCD EN ENO OUT IN MW10 QW12 FBD LI W4 BTI TMW20 LMW10 ITB TQW12 STL Number entered in BCD Number displayed in BCD Conversion BCD->Integer Task Conversion BCD<-Integer User program with integer math operations IN BCD_I EN ENO OUT IN I W4 MW20 I_BCD IN ENENO OUT MW10 QW12 LAD
Date: File:PRO1_08E.20 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Comparison Operations STL AM0.0 A ( LI W0 LI W2 ==I ) =Q9.7 LAD CMP ==I IN1 IN2 I W0 I W2 M0.0 Q 9.7 FBD IN1 IN2 M0.0 I W0 I W2 & = Q9.7 CMP ==I
Date: File:PRO1_08E.21 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives LADFBDSTL Basic Mathematical Functions Subtrac- tion Multipli- cation Division Addition LMW4 LMW10 + I TMW6 MW10 ADD_I IN2 EN ENO OUT IN1 MW4 MW6 MW10 ADD_I IN2 EN ENO OUT IN1 MW4 MW6 SUB_I IN2 EN ENO IN1 MW5 MW11 MW7 OUT MW11 SUB_I IN2 EN ENO OUT IN1 MW5 MW7 LMW5 LMW11 - I TMW7 MD6 MD12 MUL_R EN ENO IN1 MD66 IN2 MD12 MUL_R IN2 EN ENO OUT IN1 MD6 MD66 LMD6 LMD12 * R TMD66 MD40 MD4 EN ENO IN1 IN2 MD32 OUT DIV_R MD4 DIV_R IN2 EN ENO OUT IN1 MD40 MD32 LMD40 LMD4 / R TMD32
Date: File:PRO1_08E.22 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Exercise: Counting the Transported Parts (FC 18) V AI1AI2AO1AO2 AI2 AI1 -15V...+15V AI1 AI2 AO1 AO2 V DI I 0.0 I 0.1 I 0.2 I 0.3 I 0.4 I 0.5 I 0.6 I 0.7 DO AUTO / MANUAL System_ON Accept System MANUAL AUTO System_OFF Q Q Jog_RIGHT Jog_LEFT QW 12 / QW 6 ACTUAL number of parts Ack_Dist Disturbance SETPOINT number of parts Weight IW 4 / IW 2 I 1.0
Date: File:PRO1_08E.23 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Conversion Operations I -> DI -> REAL AWL LMW12 ITD DTR TMD26 IN I_DI EN ENO OUT IN MW12 MD14 IN DI_R EN ENO OUT IN MD14 MD26 FBDFBD Math program with real numbers Conversion from double integer to real number Conversion from integer to double integer Task Data in integer format (16 bits) LAD IN DI_R ENENO OUT MD14 MD26 IN I_DI ENENO OUT MW12MD14 IN
Date: File:PRO1_08E.24 SIMATIC S7 Siemens AG All rights reserved. SITRAIN Training for Automation and Drives Digital Logic Operations LIW 0 LW#16#5F2A AW / OW / XOW TMW IW0 = W#16#5F2A = WAND_W WXOR_W WOR_W EN ENO IN2 OUT W#16#5F2A MW10 IN1IW XOR MW10 nach “XOW” OR MW10 after “OW” AND MW10 after “AW”