| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
SIMATIC S7-200 Programmable Controller System Manual Installing S
Top Searches for this datasheetPreface, Contents Product Overview Getting Started SIMATIC S7-200 Programmable Controller System Manual Installing S7-200 Concepts Programming Concepts, Conventions Features S7-200 Instruction Communicating over Network Hardware Troubleshooting Guide Software Debugging Tools Creating Program Position Module Creating Program Modem Module Using Protocol Library Control MicroMaster Drive Using Modbus Protocol Library Technical Specifications Calculating Power Budget Error Codes Special Memory (SM) Bits S7-200 Order Numbers Execution Times Instructions S7-200 Quick Reference Information 6ES7 298-8FA22- 8BH0 Index Release Safety Guidelines This manual contains notices which should observe ensure your personal safety, well protect product connected equipment. These notices highlighted manual warning triangle marked follows according level danger: Danger Danger indicates imminently hazardous situation which, avoided, will result death serious injury. Warning Warning indicates potentially hazardous situation which, avoided, could result death serious injury. Caution Caution used with safety alert symbol indicates potentially hazardous situation which, avoided, result minor moderate injury. Caution Caution used without safety alert symbol indicates potentially hazardous situation which, avoided, result property damage. Notice Notice indicates potential situation which, avoided, result undesirable result state. Qualified Personnel Only qualified personnel should allowed install work this equipment. Qualified persons defined persons authorized commission, ground, circuits, equipment, systems accordance with established safety practices standards. Correct Usage Note following: Warning This device components only used applications described catalog technical descriptions, only connection with devices components from other manufacturers which have been approved recommended Siemens. This product only function correctly safely transported, stored, installed correctly, operated maintained recommended. Trademarks SIMATIC SIMATIC SIMATIC registered trademarks SIEMENS Some other designations used these documents also registered trademarks; owner's rights violated they used third parties their purposes. Copyright Siemens 2002 rights reserved reproduction, transmission this document contents permitted without express written authority. Offenders will liable damages. rights, including rights created patent grant registration utility model design, reserved. Disclaimer Liability have checked contents this manual agreement with hardware software described. Since deviations cannot precluded entirely, cannot guarantee full agreement. However, data this manual reviewed regularly necessary corrections included subsequent editions. Suggestions improvement welcomed. Siemens Automation Drives (A&D) Industrial Automation Systems (AS) Postfach 4848, 90327 Siemens Aktiengesellschaft Siemens 2002 Technical data subject change. Preface S7-200 series line micro-programmable logic controllers (Micro PLCs) that control variety automation applications. Compact design, cost, powerful instruction make S7-200 perfect solution controlling small applications. wide variety S7-200 models Windows-based programming tool give flexibility need solve your automation problems. Audience This manual provides information about installing programming S7-200 Micro PLCs designed engineers, programmers, installers, electricians have general knowledge programmable logic controllers. Scope Manual information contained this manual pertains particular following products: S7-200 models: 221, 222, 224, 226, 226XM S7-200 expansion modules STEP 7-Micro/WIN, version 3.2, 32-bit programming software package S7-200 STEP 7-Micro/WIN Instruction Libraries TP-Designer TP070, Version 1.0, software tools customers S7-200 with other components, such TP070 Touch Panel, Modbus, MicroMaster drive Standards Compliance SIMATIC S7-200 series meets following standards: European Community (CE) Voltage Directive 73/23/EEC 61131-2: Programmable Controllers Equipment requirements European Community (CE) Directive 89/336/EEC Electromagnetic emissions standard 50081-1: residential, commercial, light industry 50081-2: industrial environment Electromagnetic immunity standards 61000-6-2: industrial environment Underwriters Laboratories, Inc. Listed (Industrial Control Equipment) Registration number E75310 Canadian Standards Association: C22.2 Number Certified (Process Control Equipment) Factory Mutual Research: Class Division Groups Hazardous Locations, Class Zone IIC, Refer Appendix compliance information. S7-200 Programmable Controller System Manual Maritime Approvals time this manual printed, SIMATIC S7-200 series maritime agencies identifed below. latest product approvals, contact your local Siemens distributor sales office. Agency Lloyds Register Shipping (LRS) American Bureau Shipping (ABS) Germanischer Lloyd (GL) Norske Veritas (DNV) Bureau Veritas (BV) Nippon Kaiji Kyokai (NK) Certificate Number 20018(E1) 01-HG20020-PDA A-8071 09051 A-534 This Manual first-time (novice) user S7-200 Micro PLCs, should read entire S7-200 Programmable Controller System Manual. experienced user, refer table contents index find specific information. S7-200 Programmable Controller System Manual organized according following topics: Chapter (Product Overview) provides overview some features S7-200 family Micro products. Chapter (Getting Started) provides tutorial creating downloading sample control program S7-200. Chapter (Installing S7-200) provides dimensions basic guidelines installing S7-200 modules expansion modules. Chapter (PLC Concepts) provides information about operation S7-200. Chapter (Programming Concepts, Conventions, Features) provides information about features STEP 7-Micro/WIN, program editors types instructions (IEC 1131-3 SIMATIC), S7-200 data types, guidelines creating programs. Chapter (S7-200 Instruction Set) provides descriptions examples programming instructions supported S7-200. Chapter (Communicating over Network) provides information setting different network configurations supported S7-200. Chapter (Hardware Troubleshooting Guide Software Debugging Tools) provides information troubleshooting problems with S7-200 hardware about STEP 7-Micro/WIN features that help debug your program. Chapter (Creating Program Position Module) provides information about instructions wizard used create program Position module. Chapter (Creating Program Modem Module) provides information about instructions wizard used create program Modem module. Chapter (Using Protocol Library Control MicroMaster Drive) provides information about instructions used create control program MicroMaster drive. also provides information about configure MicroMaster MicroMaster drives. Chapter (Using Modbus Protocol Library) provides information about instructions used create program that uses Modbus protocol communications. Appendix (Technical Specifications) provides technical information data sheets about S7-200 hardware. other appendices provide additional reference information, such descriptions error codes, descriptions Special Memory (SM) area, part numbers ordering S7-200 equipment, instruction execution times. Preface Additional Information Assistance Information about S7-200 STEP Micro/WIN addition this manual, STEP 7-Micro/WIN provides extensive online help getting started with programming S7-200. Included with purchase STEP 7-Micro/WIN software free documentation this find application tips, electronic version this manual other information. Online Help Help only keystroke away! Pressing accesses extensive online help STEP 7-Micro/WIN. online help includes useful information about getting started with programming S7-200, well many other topics. Electronic Manual electronic version this S7-200 System Manual available documentation install electronic manual onto your computer that easily access information manual while working with STEP 7-Micro/WIN software. Tips Tricks documentation includes Tips Tricks, application examples with sample programs. Reviewing modifying these examples help find efficient innovative solutions your application. also find most current version Tips Tricks S7-200 Internet site. Internet: www.siemens.com/S7-200 additional information about Siemens products services, technical support, frequently asked questions (FAQs), product updates, application tips, refer following Internet addresses: www.ad.siemens.de general Siemens information This Siemens Automation Drives Internet site includes information about SIMATIC product line other products available from Siemens. www.siemens.com/S7-200 S7-200 product information S7-200 Internet site includes frequently asked questions (FAQs), Tips Tricks (application examples sample programs), information about newly released products, product updates downloads. S7-200 Programmable Controller System Manual Technical Assistance Purchasing S7-200 Products Local Siemens Sales Office Distributor assistance answering technical questions, training S7-200 products, ordering S7-200 products, contact your Siemens distributor sales office. Because your sales representatives technically trained have most specific knowledge about your operations, process industry, well about individual Siemens products that using, they provide fastest most efficient answers problems that might encounter. Technical Services highly trained staff S7-200 Technical Services center also available help solve problems that might encounter. call them hours day, days week: calls originating from within United States America Local time: Monday Friday 0800 1900 Eastern time Telephone: 241-4453 Fax: 740-3699 E-Mail: drives.support@sea.siemens.com calls originating from Americas outside Local time: Monday Friday 0800 1900 Eastern time Telephone: 740-3505 Fax: 740-3699 E-Mail: drives.support@sea.siemens.com calls originating from Europe Africa Local time (Nuremberg): Monday Friday 0700 1700 Telephone: 5050-222 Fax: 5050-223 E-Mail: techsupport@ad.siemens.de calls originating from Asia Australia Local time (Singapore): Monday Friday 0830 1730 Telephone: 740-7000 Fax: 740-7001 E-Mail: Contents Product Overview S7-200 S7-200 Expansion Modules STEP 7-Micro/WIN Programming Package Communications Options Display Panels Getting Started Connecting S7-200 Creating Sample Program Downloading Sample Program Placing S7-200 Mode Installing S7-200 Guidelines Installing S7-200 Devices Installing Removing S7-200 Modules Guidelines Grounding Wiring Concepts Understanding S7-200 Executes Your Control Logic Accessing Data S7-200 Understanding S7-200 Saves Restores Data Storing Your Program Memory Cartridge Selecting Operating Mode S7-200 Using Your Program Save Memory EEPROM Features S7-200 Programming Concepts, Conventions, Features Guidelines Designing Micro System Basic Elements Program Using STEP 7-Micro/WIN Create Your Programs Choosing Between SIMATIC 1131-3 Instruction Sets Understanding Conventions Used Program Editors Using Wizards Help Create Your Control Program Handling Errors S7-200 Assigning Addresses Initial Values Data Block Editor Using Symbol Table Symbolic Addressing Variables Using Local Variables Using Status Chart Monitor Your Program Creating Instruction Library Features Debugging Your Program S7-200 Programmable Controller System Manual S7-200 Instruction Conventions Used Describe Instructions S7-200 Memory Ranges Features Logic Instructions Contacts Coils Logic Stack Instructions Reset Dominant Bistable Instructions Clock Instructions Communications Instructions Network Read Network Write Instructions Transmit Receive Instructions (Freeport) Port Address Port Address Instructions Compare Instructions Comparing Numerical Values Compare String Conversion Instructions Standard Conversion Instructions ASCII Conversion Instructions String Conversion Instructions Encode Decode Instructions Counter Instructions SIMATIC Counter Instructions Counter Instructions High-Speed Counter Instructions Pulse Output Instruction Math Instructions Add, Subtract, Multiply, Divide Instructions Multiply Integer Double Integer Divide Integer with Remainder Numeric Functions Instructions Increment Decrement Instructions (PID) Loop Instruction Interrupt Instructions Logical Operations Instructions Invert Instructions AND, Exclusive Instructions Move Instructions Move Byte, Word, Double Word, Real Move Byte Immediate (Read Write) Block Move Instructions Program Control Instructions Conditional Stop Watchdog Reset For-Next Loop Instructions Jump Instructions Sequence Control Relay (SCR) Instructions viii Contents Shift Rotate Instructions Shift Right Shift Left Instructions Rotate Right Rotate Left Instructions Shift Register Instruction Swap Bytes Instruction String Instructions Table Instructions Table First-In-First-Out Last-In-First-Out Memory Fill Table Find Timer Instructions SIMATIC Timer Instructions Timer Instructions Subroutine Instructions Communicating over Network Understanding Basics S7-200 Network Communications Selecting Communications Protocol Your Network Installing Removing Communications Interfaces Building Your Network Creating User-Defined Protocols with Freeport Mode Using Modems STEP 7-Micro/WIN with Your Network Advanced Topics Hardware Troubleshooting Guide Software Debugging Tools Features Debugging Your Program Displaying Program Status Using Status Chart Monitor Modify Data S7-200 Forcing Specific Values Running Your Program Specified Number Scans Hardware Troubleshooting Guide Creating Program Position Module Features Position Module Configuring Position Module Position Instructions Created Motion Control Wizard Sample Programs Position Module Monitoring Position Module with Control Panel Error Codes Position Module Position Instructions Advanced Topics S7-200 Programmable Controller System Manual Creating Program Modem Module Features Modem Module Using Modem Expansion Wizard Configure Modem Module Overview Modem Instructions Restrictions Instructions Modem Module Sample Program Modem Module S7-200 CPUs that Support Intelligent Modules Special Memory Location Modem Module Advanced Topics Messaging Telephone Number Format Text Message Format Data Transfer Message Format Using Protocol Library Control MicroMaster Drive Requirements Using Protocol Calculating Time Required Communicating with Drive Using Instructions Instructions Protocol Sample Programs Protocol Execution Error Codes Connecting Setting MicroMaster Series Drive Connecting Setting MicroMaster Series Drive Using Modbus Protocol Library Requirements Using Modbus Protocol Initialization Execution Time Modbus Protocol Modbus Addressing Using Modbus Slave Protocol Instructions Instructions Modbus Slave Protocol Technical Specifications General Technical Specifications Specifications Digital Expansion Modules Specifications Analog Expansion Modules Specifications Thermocouple Expansion Modules Specifications PROFIBUS-DP Module Specifications Modem Module Specifications Position Module Specifications AS-Interface 243-2) Module Specifications Optional Cartridges Expansion Cable PC/PPI Cable Input Simulators Calculating Power Budget Contents Error Codes Fatal Error Codes Messages Run-Time Programming Problems Compile Rule Violations Special Memory (SM) Bits SMB0: Status Bits SMB1: Status Bits SMB2: Freeport Receive Character SMB3: Freeport Parity Error SMB4: Queue Overflow SMB5: Status SMB6: Register SMB7: Reserved SMB8 SMB21: Module Error Registers SMW22 SMW26: Scan Times SMB28 SMB29: Analog Adjustment SMB30 SMB130: Freeport Control Registers SMB31 SMW32: Permanent Memory (EEPROM) Write Control SMB34 SMB35: Time Interval Registers Timed Interrupts SMB36 SMB65: HSC0, HSC1, HSC2 Register SMB66 SMB85: PTO/PWM Registers SMB86 SMB94, SMB186 SMB194: Receive Message Control SMW98: Errors Expansion SMB130: Freeport Control Register (see SMB30) SMB131 SMB165: HSC3, HSC4, HSC5 Register SMB166 SMB185: PTO0, PTO1 Profile Definition Table SMB186 SMB194: Receive Message Control (see SMB86 SMB94) SMB200 SMB549: Intelligent Module Status S7-200 Order Numbers Execution Times Instructions S7-200 Quick Reference Information Index S7-200 Programmable Controller System Manual Product Overview S7-200 series micro-programmable logic controllers (Micro PLCs) control wide variety devices support your automation needs. S7-200 monitors inputs changes outputs controlled user program, which include Boolean logic, counting, timing, complex math operations, communications with other intelligent devices. compact design, flexible configuration, powerful instruction combine make S7-200 perfect solution controlling wide variety applications. This Chapter S7-200 S7-200 Expansion Modules STEP 7-Micro/WIN Programming Package Communications Options Display Panels S7-200 Programmable Controller System Manual S7-200 S7-200 combines microprocessor, integrated power supply, input circuits, output circuits compact housing create powerful Micro PLC. Figure 1-1. After have downloaded your program, S7-200 contains logic required monitor control input output devices your application. LEDs Access door: Mode selector switch (RUN/STOP) Analog adjustment potentiometer(s) Expansion port (for most CPUs) Terminal connector (removable 224, 226XM) Clip installation standard (DIN) rail Status LEDs: System Fault STOP Optional cartridge: EEPROM Real-time Clock Battery Communications port Figure S7-200 Micro Siemens provides different S7-200 models with diversity features capabilities that help create effective solutions your varied applications. Table briefly compares some features CPU. detailed information about specific CPU, Appendix Table Feature Physical size (mm) Program memory Data memory Memory backup Local on-board Expansion modules High-speed counters Single phase phase Pulse outputs (DC) Analog adjustments Real-time clock Communications ports Floating-point math Digital image size Boolean execution speed Comparison S7-200 Models 2048 words 1024 words hours typical In/4 Cartridge (128 out) 0.37 microseconds/instruction RS-485 2048 words 1024 words hours typical In/6 Cartridge RS-485 120.5 4096 words 2560 words hours typical In/10 Built-in RS-485 4096 words 2560 words hours typical In/16 Built-in RS-485 226XM 8192 words 5120 words hours typical In/16 Built-in RS-485 Chapter Title Chapter S7-200 Expansion Modules better solve your application requirements, S7-200 family includes wide variety expansion modules. these expansion modules additional functionality S7-200 CPU. Table provides list expansion modules that currently available. detailed information about specific module, Appendix Table S7-200 Expansion Modules Types Input Output Combination Relay Analog modules Input Analog Output Analog Combination Analog Analog Intelligent modules Other modules Position AS-Interface Modem PROFIBUS-DP Relay Thermocouple Relay Relay Expansion Modules Discrete modules STEP 7-Micro/WIN Programming Package STEP 7-Micro/WIN programming package provides user-friendly environment develop, edit, monitor logic needed control your application. STEP 7-Micro/WIN provides three program editors convenience efficiency developing control program your application. help find information need, STEP 7-Micro/WIN provides extensive online help system documentation that contains electronic version this manual, application tips, other useful information. Computer Requirements STEP 7-Micro/WIN runs either personal computer Siemens programming device, such 760. Your computer programming device should meet following minimum requirements: Operating system: Windows Windows Windows 2000, Windows (Millennium Edition), Windows later version) least bytes free hard disk space Mouse (recommended) Figure STEP 7-Micro/WIN S7-200 Programmable Controller System Manual Installing STEP Micro/WIN Insert STEP 7-Micro/WIN into CD-ROM drive your computer. installation wizard starts automatically prompts through installation process. Refer Readme file more information about installing STEP 7-Micro/WIN. install STEP 7-Micro/WIN Windows Windows 2000 operating system, must with Administrator privileges. Communications Options Siemens provides programming options connecting your computer your S7-200: direct connection with PC/PPI cable, Communications Processor (CP) card with cable PROFIBUS-DP networks. PC/PPI programming cable most common economical method connecting your computer S7-200. This cable connects communications port S7-200 serial communications your computer. PC/PPI programming cable also used connect other communications devices S7-200. cable, must also install card your computer. card provides extra hardware required connect higher baud rates handle high-speed network communications. Display Panels Text Display Unit 2-line, 20-character, text display device that connected S7-200. Using wizard, easily program your S7-200 display text messages other data pertaining your application. provides cost interface your application allowing view, monitor, change process variables pertaining your application. separate manual describes detailed functionality specifications 200. Figure Text Display Unit TP070 Touch Panel Display TP070 touch panel display device that connected S7-200. This touch panel provides with means customize your operator interface. TP070 display custom graphics, slider bars, application variables, custom user buttons, forth, means user-friendly touch panel. optional TP-Designer TP070, Version provides Designer software, which required programming your TP070. Figure TP070 Touch Panel Unit Getting Started STEP 7-Micro/WIN makes easy program your S7-200. just short steps using simple example, learn connect, program, your S7-200. need this example PC/PPI cable, S7-200 CPU, programming device running STEP 7-Micro/WIN programming software. This Chapter Connecting S7-200 Creating Sample Program Downloading Sample Program Placing S7-200 Mode S7-200 Programmable Controller System Manual Connecting S7-200 Connecting your S7-200 easy. this example, only need connect power your S7-200 then connect communications cable between your programming device S7-200 CPU. Connecting Power S7-200 first step connect S7-200 power source. Figure shows wiring connections either model S7-200 CPU. Before install remove electrical device, ensure that power that equipment been turned off. Always follow appropriate safety precautions ensure that power S7-200 disabled before attempting install remove S7-200. Warning Attempts install wire S7-200 related equipment with power applied could cause electric shock faulty operation equipment. Failure disable power S7-200 related equipment during installation removal procedures could result death serious injury personnel, and/or damage equipment. Always follow appropriate safety precautions ensure that power S7-200 disabled before attempting install remove S7-200 related equipment. Installation Installation Figure Connecting Power S7-200 Connecting PC/PPI Cable Figure shows PC/PPI cable connecting S7-200 programming device. connect PC/PPI cable: Connect RS-232 connector (marked "PC") PC/PPI cable communications port programming device. (For this example, connect Connect RS-485 connector (marked "PPI") PC/PPI cable Port Port S7-200. Ensure that dipswitches PC/PPI cable shown Figure 2-2. Programming Device S7-200 PC/PPI cable Figure Connecting PC/PPI Cable Chapter Title Chapter Starting STEP Micro/WIN Click STEP 7-Micro/WIN icon open project. Figure shows project. Notice navigation bar. icons navigation open elements STEP 7-Micro/WIN project. Click Communications icon navigation display Communications dialog box. this dialog communications STEP 7-Micro/WIN. Navigation Communications icon Figure STEP 7-Micro/WIN Project Verifying Communications Parameters STEP Micro/WIN example project uses default settings STEP 7-Micro/WIN PC/PPI cable. verify these settings: Verify that address PC/PPI cable Communications dialog Verify that interface network parameter PC/PPI cable(COM1). Verify that transmission rate kbps. Figure Verifying Communications Parameters need change your communications parameter settings, Chapter Establishing Communications with S7-200 Communications dialog connect with your S7-200 CPU: Double-click refresh icon Communications dialog box. STEP 7-Micro/WIN searches S7-200 station displays icon connected S7-200 station. Select S7-200 click STEP 7-Micro/WIN does find your S7-200 CPU, check settings communications parameters repeat these steps. After have established communications with S7-200, ready create 200, download example program. Figure Establishing Communications S7-200 S7-200 Programmable Controller System Manual Creating Sample Program Entering this example control program will help understand easy STEP 7-Micro/WIN. This program uses instructions three networks create very simple, self-starting timer that resets itself. this example, Ladder (LAD) editor enter instructions program. following example shows complete program both Statement List (STL). network comments program explain logic each network. timing diagram shows operation program. Example: Sample Program getting started with STEP Micro/WIN Network Network //10 timer times after (100 //M0.0 pulse fast monitor with Status view. M0.0 T33, +100 //Comparison becomes true rate that visible with //Status view. Turn Q0.0 after //for OFF/60% waveform. T33, Q0.0 //T33 (bit) pulse fast monitor with Status view. //Reset timer through M0.0 after //(100 period. M0.0 LDW>= Network Timing Diagram current current (current) 0.4s 0.6s (bit) M0.0 Q0.0 Getting Started Chapter Opening Program Editor Click Program Block icon open program editor. Figure 2-6. Notice instruction tree program editor. instruction tree insert instructions into networks program editor dragging dropping instructions from instruction tree networks. toolbar icons provide shortcuts menu commands. After enter save program, download program S7-200. Program editor Instruction tree Figure STEP 7-Micro/WIN Window Entering Network Starting Timer When M0.0 (0), this contact turns provides power flow start timer. enter contact M0.0: Either double-click Logic icon click plus sign display logic instructions. Select Normally Closed contact. Hold down left mouse button drag contact onto first network. Click "???" above contact enter following address: M0.0 Press Return enter address contact. Figure Network enter timer instruction T33: Double-click Timers icon display timer instructions. Select (On-Delay Timer). Hold down left mouse button drag timer onto first network. Click "???" above timer enter following timer number: Press Return enter timer number move focus preset time (PT) parameter. Enter following value preset time: Press Return enter value. S7-200 Programmable Controller System Manual Entering Network Turning Output When timer value greater than equal times milliseconds, seconds), contact provides power flow turn output Q0.0 S7-200. enter Compare instruction: Double-click Compare icon display compare instructions. Select instruction Hold down left mouse button drag compare instruction onto second network. Click "???" above contact enter address timer value: Press Return enter timer number move focus other value compared with timer value. Enter following value compared with timer value: Press Return enter value. Figure Network enter instruction turning output Q0.0: Double-click Logic icon display logic instructions select output coil. Hold down left mouse button drag coil onto second network. Click "???" above coil enter following address: Q0.0 Press Return enter address coil. Entering Network Resetting Timer When timer reaches preset value (100) turns timer contact turns Power flow from this contact turns M0.0 memory location. Because timer enabled Normally Closed contact M0.0, changing state M0.0 from resets timer. enter contact timer T33: Select Normally Open contact from logic instructions. Hold down left mouse button drag contact onto third network. Click "???" above contact enter address timer bit: Press Return enter address contact. enter coil turning M0.0: Select output coil from logic instructions. Figure Network Hold down left mouse button drag output coil onto third network. Double-click "???" above coil enter following address: M0.0 Press Return enter address coil. Getting Started Chapter Saving Sample Project After entering three networks instructions, have finished entering program. When save program, create project that includes S7-200 type other parameters. save project: Select File Save menu command from menu bar. Enter name project Save dialog box. Click save project. After saving project, download program S7-200. Figure 2-10 Saving Example Program Downloading Sample Program Each STEP 7-Micro/WIN project associated with type (CPU 221, 222, 224, 226, 226XM). project type does match which connected, STEP 7-Micro/WIN indicates mismatch prompts take action. this occurs, choose "Continue Download" this example. Click Download icon toolbar select File Download menu command download program. Figure 2-11. Click download elements program S7-200. your S7-200 mode, dialog prompts place S7-200 STOP mode. Click place S7-200 into STOP mode. Figure 2-11 Downloading Program Placing S7-200 Mode STEP 7-Micro/WIN place S7-200 mode, mode switch S7-200 must TERM RUN. When place S7-200 mode, S7-200 executes program: Click icon toolbar select menu command. Click change operating mode S7-200. When S7-200 goes mode, output Q0.0 turns S7-200 executes program. Figure 2-12 Placing S7-200 Mode Congratulations! have just completed your first S7-200 program. monitor program selecting Debug Program Status menu command. STEP 7-Micro/WIN displays values instructions. stop program, place S7-200 STOP mode clicking STOP icon selecting STOP menu command. S7-200 Programmable Controller System Manual Installing S7-200 S7-200 equipment designed easy install. mounting holes attach modules panel, built-in clips mount modules onto standard (DIN) rail. small size S7-200 allows make efficient space. This chapter provides guidelines installing wiring your S7-200 system. This Chapter Guidelines Installing S7-200 Devices Installing Removing S7-200 Modules Guidelines Grounding Wiring S7-200 Programmable Controller System Manual Guidelines Installing S7-200 Devices install S7-200 either panel standard rail, orient S7-200 either horizontally vertically. Separate S7-200 Devices from Heat, High Voltage, Electrical Noise general rule laying devices your system, always separate devices that generate high voltage high electrical noise from low-voltage, logic-type devices such S7-200. When configuring layout S7-200 inside your panel, consider heat-generating devices locate electronic-type devices cooler areas your cabinet. Operating electronic device high-temperature environment will reduce time failure. Consider also routing wiring devices panel. Avoid placing voltage signal wires communications cables same tray with power wiring high-energy, rapidly-switched wiring. Provide Adequate Clearance Cooling Wiring S7-200 devices designed natural convection cooling. proper cooling, must provide clearance least above below devices. Also, allow least depth. vertical mounting, maximum allowable ambient temperature reduced Mount S7-200 below expansion modules. When planning your layout S7-200 system, allow enough clearance wiring communications cable connections. additional flexibility configuring layout S7-200 system, expansion cable. Clearance Rail Front enclosure Mounting surface Vertical Panel Mounting Side View Horizontal Rail Mounting with Optional Expansion Cable (limit system) Figure Mounting Methods, Orientation, Clearance Installing S7-200 Chapter Power Budget S7-200 CPUs have internal power supply that provides power CPU, expansion modules, other user power requirements. S7-200 provides logic power needed expansion your system. careful attention your system configuration ensure that your supply power required your selected expansion modules. your configuration requires more power than supply, must remove module select with more power capability. Refer Appendix information about logic budget supplied your S7-200 power requirements expansion modules. Appendix guide determining much power current) provide your configuration. S7-200 CPUs also provide sensor supply that supply input points, relay coil power expansion modules, other requirements. your power requirements exceed budget sensor supply, then must external power supply your system. Refer Appendix sensor supply power budget your particular S7-200 CPU. require external power supply, ensure that power supply connected parallel with sensor supply S7-200 CPU. improved electrical noise protection, recommended that commons different power supplies connected. Warning Connecting external power supply parallel with S7-200 sensor supply result conflict between supplies each seeks establish preferred output voltage level. result this conflict shortened lifetime immediate failure both power supplies, with consequent unpredictable operation system. Unpredictable operation could result death serious injury personnel, and/or damage equipment. S7-200 sensor supply external power supply should provide power different points. Installing Removing S7-200 Modules S7-200 easily installed standard rail panel. Prerequisites Before install remove electrical device, ensure that power that equipment been turned off. Also, ensure that power related equipment been turned off. Warning Attempts install remove S7-200 related equipment with power applied could cause electric shock faulty operation equipment. Failure disable power S7-200 related equipment during installation removal procedures could result death serious injury personnel, and/or damage equipment. Always follow appropriate safety precautions ensure that power S7-200 disabled before attempting install remove S7-200 CPUs related equipment. Always ensure that whenever replace install S7-200 device correct module equivalent device. Warning install incorrect module, program S7-200 could function unpredictably. Failure replace S7-200 device with same model, orientation, order could result death serious injury personnel, and/or damage equipment. Replace S7-200 device with same model, sure orient position correctly. S7-200 Programmable Controller System Manual Mounting Dimensions S7-200 CPUs expansion modules include mounting holes facilitate installation panels. Refer Table mounting dimensions. Table Mounting Dimensions Minimum spacing between modules when hard-mounted Mounting holes S7-200 Module 226XM Expansion modules: Expansion modules: Width 120.5 71.2 Width 112.5 63.2 8-point Relay (8I, 4I/4Q, 16-point digital (8I/8Q), Analog (4AI, 4AI/1AQ), RTD, Thermocouple, PROFIBUS, AS-Interface, 8-point 8Q), Position, Modem 32-point digital (16I/16Q) Expansion modules: 137.3 129.3 Installing Expansion Module Installing S7-200 easy! Just follow these steps. Panel Mounting Locate, drill, mounting holes American Standard number using dimensions Table 3-1. Secure module(s) panel, using appropriate screws. using expansion module, connect expansion module ribbon cable into expansion port connector under access door. Rail Mounting Secure rail mounting panel every Snap open clip (located bottom module) hook back module onto rail. using expansion module, connect expansion module ribbon cable into expansion port connector under access door. Rotate module down rail snap clip closed. Carefully check that clip fastened module securely onto rail. avoid damage module, press mounting hole instead pressing directly front module. Installing S7-200 Chapter Using rail stops could helpful your S7-200 environment with high vibration potential S7-200 been installed vertically. your system high-vibration environment, then panel-mounting S7-200 will provide greater level vibration protection. Removing Expansion Module remove S7-200 expansion module, follow these steps: Remove power from S7-200. Disconnect wiring cabling that attached module. Most S7-200 expansion modules have removable connectors make this easier. have expansion modules connected unit that removing, open access cover door disconnect expansion module ribbon cable from adjacent modules. Unscrew mounting screws snap open clip. Remove module. Removing Reinstalling Terminal Block Connector Most S7-200 modules have removable connectors make installing replacing module easy. Refer Appendix determine whether your S7-200 module removable connectors. order optional fan-out connector modules that have removable connectors. Appendix order numbers. Remove Connector Open connector door gain access connector. Insert small screwdriver notch middle connector. Remove terminal connector prying screwdriver away from S7-200 housing. Figure 3-2. Figure Removing Connector Reinstall Connector Open connector door. Align connector with pins unit align wiring edge connector inside connector base. Press down firmly rotate connector until snaps into place. Check carefully ensure that connector properly aligned fully engaged. S7-200 Programmable Controller System Manual Guidelines Grounding Wiring Proper grounding wiring electrical equipment important help ensure optimum operation your system provide additional electrical noise protection your application S7-200. Prerequisites Before ground install wiring electrical device, ensure that power that equipment been turned off. Also, ensure that power related equipment been turned off. Ensure that follow applicable electrical codes when wiring S7-200 related equipment. Install operate equipment according applicable national local standards. Contact your local authorities determine which codes standards apply your specific case. Warning Attempts install wire S7-200 related equipment with power applied could cause electric shock faulty operation equipment. Failure disable power S7-200 related equipment during installation removal procedures could result death serious injury personnel, and/or damage equipment. Always follow appropriate safety precautions ensure that power S7-200 disabled before attempting install remove S7-200 related equipment. Always take safety into consideration design grounding wiring your S7-200 system. Electronic control devices, such S7-200, fail cause unexpected operation equipment that being controlled monitored. this reason, should implement safeguards that independent S7-200 protect against possible personal injury equipment damage. Warning Control devices fail unsafe condition, resulting unexpected operation controlled equipment. Such unexpected operations could result death serious injury personnel, and/or damage equipment. emergency stop function, electromechanical overrides, other redundant safeguards that independent S7-200. Guidelines Isolation S7-200 power supply boundaries boundaries circuits rated 1500 VAC. These isolation boundaries have been examined approved providing safe separation between line voltage circuits. voltage circuits connected S7-200, such power, must supplied from approved source that provides safe isolation from line other high voltages. Such sources include double insulation defined international electrical safety standards have outputs that rated SELV, PELV, Class Limited Voltage according various standards. Warning non-isolated single insulation supplies supply voltage circuits from line result hazardous voltages appearing circuits that expected touch safe, such communications circuits voltage sensor wiring. Such unexpected high voltages could result death serious injury personnel, and/or damage equipment. Only high voltage voltage power converters that approved sources touch safe, limited voltage circuits. Installing S7-200 Chapter Guidelines Grounding S7-200 best ground your application ensure that common connections your S7-200 related equipment grounded single point. This single point should connected directly earth ground your system. improved electrical noise protection, recommended that common returns connected same single-point earth ground. Connect sensor supply common earth ground. ground wires should short possible should large wire size, such AWG). When locating grounds, remember consider safety grounding requirements proper operation protective interrupting devices. Guidelines Wiring S7-200 When designing wiring your S7-200, provide single disconnect switch that simultaneously removes power from S7-200 power supply, from input circuits, from output circuits. Provide overcurrent protection, such fuse circuit breaker, limit fault currents supply wiring. might want provide additional protection placing fuse other current limit each output circuit. Install appropriate surge suppression devices wiring that could subject lightning surges. Avoid placing low-voltage signal wires communications cables same wire tray with wires high-energy, rapidly switched wires. Always route wires pairs, with neutral common wire paired with signal-carrying wire. shortest wire possible ensure that wire sized properly carry required current. connector accepts wire sizes from AWG). shielded wires optimum protection against electrical noise. Typically, grounding shield S7-200 gives best results. When wiring input circuits that powered external power supply, include overcurrent protection device that circuit. External protection necessary circuits that powered sensor supply from S7-200 because sensor supply already current-limited. Most S7-200 modules have removable connectors user wiring. (Refer Appendix determine your module removable connectors.) prevent loose connections, ensure that connector seated securely that wire installed securely into connector. avoid damaging connector, careful over-tighten screws. maximum torque connector screw 0.56 inch-pounds). help prevent unwanted current flows your installation, S7-200 provides isolation boundaries certain points. When plan wiring your system, should consider these isolation boundaries. Refer Appendix amount isolation provided location isolation boundaries. Isolation boundaries rated less than 1500VAC must depended safety boundaries. communications network, maximum length communications cable without using repeater. communications port S7-200 non-isolated. Refer Chapter more information. S7-200 Programmable Controller System Manual Guidelines Suppression Circuits should equip inductive loads with suppression circuits limit voltage rise when control output turns off. Suppression circuits protect your outputs from premature failure high inductive switching currents. addition, suppression circuits limit electrical noise generated when switching inductive loads. effectiveness given suppression circuit depends application, must verify your particular use. Always ensure that components used your suppression circuit rated application. Outputs Relays That Control Loads outputs have internal protection that adequate most applications. Since relays used either load, internal protection provided. Figure shows sample suppression circuit load. most applications, addition diode across inductive load suitable, your application requires faster turn-off times, then addition Zener diode recommended. sure size your Zener diode properly amount current your output circuit. (optional) I1N4001 diode equivalent Output Point Zener Outputs Zener Relay Outputs Inductive Load Figure Suppression Circuit Load Outputs Relays That Control Loads outputs have internal protection that adequate most applications. Since relays used either load, internal protection provided. Figure shows sample suppression circuit load. most applications, addition metal oxide varistor (MOV) will limit peak voltage provide protection internal S7-200 circuits. Ensure that working voltage least greater than nominal line voltage. tage Output Point Inductive Load Suppression Circuit Load Figure Concepts basic function S7-200 monitor field inputs and, based your control logic, turn field output devices. This chapter explains concepts used execute your program, various types memory used, that memory retained. This Chapter Understanding S7-200 Executes Your Control Logic Accessing Data S7-200 Understanding S7-200 Saves Restores Data Storing Your Program Memory Cartridge Selecting Operating Mode S7-200 Using Your Program Save Memory EEPROM Features S7-200 S7-200 Programmable Controller System Manual Understanding S7-200 Executes Your Control Logic S7-200 continuously cycles through control logic your program, reading writing data. S7-200 Relates Your Program Physical Inputs Outputs basic operation S7-200 very simple: S7-200 reads status inputs. Start_PB E_Stop M_Starter program that stored S7-200 uses these inputs evaluate control logic. program runs, S7-200 updates data. S7-200 writes data outputs. M_Starter Motor Output Motor Starter Input Figure shows simple diagram electrical relay diagram relates S7-200. this example, state switch starting motor combined with states other inputs. calculations these states then determine state output that goes actuator which starts motor. Figure Start Stop Switch Controlling Inputs Outputs S7-200 Executes Tasks Scan Cycle S7-200 executes series tasks repetitively. This cyclical execution tasks called scan cycle. shown Figure 4-2, S7-200 performs most following tasks during scan cycle: Reading inputs: S7-200 copies state physical inputs process-image input register. Executing control logic program: S7-200 executes instructions program stores values various memory areas. Processing communications requests: S7-200 performs tasks required communications. Executing self-test diagnostics: S7-200 ensures that firmware, program memory, expansion modules working properly. Writing outputs: values stored process-image output register written physical outputs. Writes outputs Perform Diagnostics Process Communications Requests Execute Program Scan Cycle Reads inputs Figure S7-200 Scan Cycle execution scan cycle dependent upon whether S7-200 STOP mode mode. mode, your program executed; STOP mode, your program executed. Concepts Chapter Reading Inputs Digital inputs: Each scan cycle begins reading current value digital inputs then writing these values process-image input register. Analog inputs: S7-200 does update analog inputs part normal scan cycle unless filtering analog inputs enabled. analog filter provided allow have more stable signal. enable analog filter each analog input point. When analog input filtering enabled analog input, S7-200 updates that analog input once scan cycle, performs filtering function, stores filtered value internally. filtered value then supplied each time your program accesses analog input. When analog filtering enabled, S7-200 reads value analog input from physical module each time your program accesses analog input. Analog input filtering provided allow have more stable analog value. analog input filter applications where input signal varies slowly with time. signal high-speed signal, then should enable analog filter. analog filter with modules that pass digital information alarm indications analog words. Always disable analog filtering RTD, Thermocouple, AS-Interface Master modules. Executing Program During execution phase scan cycle, S7-200 executes your program, starting with first instruction proceeding instruction. immediate instructions give immediate access inputs outputs during execution either program interrupt routine. interrupts your program, interrupt routines that associated with interrupt events stored part program. interrupt routines executed part normal scan cycle, executed when interrupt event occurs (which could point scan cycle). Processing Communications Requests During message-processing phase scan cycle, S7-200 processes messages that were received from communications port intelligent modules. Executing Self-test Diagnostics During this phase scan cycle, S7-200 checks proper operation CPU, memory areas, status expansion modules. Writing Digital Outputs every scan cycle, S7-200 writes values stored process-image output register digital outputs. (Analog outputs updated immediately, independently from scan cycle.) S7-200 Programmable Controller System Manual Accessing Data S7-200 S7-200 stores information different memory locations that have unique addresses. explicitly identify memory address that want access. This allows your program have direct access information. Table shows range integer values that represented different sizes data. Table Decimal Hexadecimal Ranges Different Sizes Data Byte Signed Integer Real IEEE 32-bit Floating Point -128 +127 applicable Word 65,535 FFFF -32,768 +32,767 8000 7FFF applicable Double Word 4,294,967,295 FFFF FFFF -2,147,483,648 +2,147,483,647 8000 0000 7FFF FFFF +1.175495E-38 +3.402823E+38 (positive) -1.175495E-38 -3.402823E+38 (negative) Representation Unsigned Integer access memory area, specify address, which includes memory area identifier, byte address, number. Figure shows example accessing (which also called "byte.bit" addressing). this example, memory area byte address input, byte followed period (".") separate address (bit byte, number: Period separates byte address from number Byte address: byte (the fourth byte) Memory area identifier Figure Byte.Bit Addressing Process-image Input Memory Area Byte Byte Byte Byte Byte Byte access data most memory areas bytes, words, double words using byte-address format. access byte, word, double word data memory, must specify address similar specifying address bit. This includes area identifier, data size designation, starting byte address byte, word, double-word value, shown Figure 4-4. Data other memory areas (such accumulators) accessed using address format that includes area identifier device number. Concepts Chapter Byte address Access byte size Area identifier Byte address Access word size Area identifier Byte address Access double word size Area identifier VB100 VB100 Most significant byte VW100 Least significant byte most significant least significant VB100 VB101 Most significant byte Least significant byte VD100 Figure VB100 VB101 VB102 VB103 Comparing Byte, Word, Double-Word Access Same Address Accessing Data Memory Areas Process-Image Input Register: S7-200 samples physical input points beginning each scan cycle writes these values process-image input register. access process-image input register bits, bytes, words, double words: Bit: Byte, Word, Double Word: I[byte address].[bit address] I[size][starting byte address] I0.1 Process-Image Output Register: scan cycle, S7-200 copies values stored process-image output register physical output points. access process-image output register bits, bytes, words, double words: Bit: Byte, Word, Double Word: Q[byte address].[bit address] Q[size][starting byte address] Q1.1 Variable Memory Area: memory store intermediate results operations being performed control logic your program. also memory store other data pertaining your process task. access memory area bits, bytes, words, double words: Bit: Byte, Word, Double Word: V[byte address].[bit address] V[size][starting byte address] V10.2 VW100 Memory Area: memory area memory) control relays store intermediate status operation other control information. access memory area bits, bytes, words, double words: Bit: Byte, Word, Double Word: M[byte address].[bit address] M[size][starting byte address] M26.7 MD20 S7-200 Programmable Controller System Manual Timer Memory Area: S7-200 provides timers that count increments time resolutions (time-base increments) variables associated with timer: Current value: this 16-bit signed integer stores amount time counted timer. Timer bit: this cleared result comparing current preset value. preset value entered part timer instruction. access both these variables using timer address timer number). Access either timer current value dependent instruction used: instructions with operands access timer bit, while instructions with word operands access current value. shown Figure 4-5, Normally Open Contact instruction accesses timer bit, while Move Word instruction accesses current value timer. Format: I2.1 MOV_W VW200 T[timer number] Current Value Timer Bits (MSB) (LSB) Accesses current value Figure Accessing Timer Current Value Timer Accesses timer Counter Memory Area: S7-200 provides three types counters that count each low-to-high transition event counter input(s): type counts only, type counts down only, type counts both down. variables associated with counter: Current value: this 16-bit signed integer stores accumulated count. Counter bit: this cleared result comparing current preset value. preset value entered part counter instruction. access both these variables using counter address counter number). Access either counter current value dependent instruction used: instructions with operands access counter bit, while instructions with word operands access current value. shown Figure 4-6, Normally Open Contact instruction accesses counter bit, while Move Word instruction accesses current value counter. Format: I2.1 MOV_W VW200 C[counter number] Current Value Counter Bits (MSB) (LSB) Accesses current value Figure Accessing Counter Current Value Counter Accesses counter Concepts Chapter High-Speed Counters: high-speed counters count high-speed events independent scan. High-speed counters have signed, 32-bit integer counting value current value). access count value high-speed counter, specify address high-speed counter, using memory type (HC) counter number (such HC0). current value high-speed counter read-only value addressed only double word bits). Format: HC[high-speed counter number] Accumulators: accumulators read/write devices that used like memory. example, accumulators pass parameters from subroutines store intermediate values used calculation. S7-200 provides four 32-bit accumulators (AC0, AC1, AC2, AC3). access data accumulators bytes, words, double words. size data being accessed determined instruction that used access accumulator. shown Figure 4-7, least significant bits value that stored accumulator access accumulator bytes words. access accumulator double word, bits. information about accumulators within interrupt subroutines, refer Interrupt Instructions Chapter Format: AC[accumulator number] (accessed byte) (accessed word) Most significant Least significant Byte Byte (accessed double word) Most significant Least significant Byte Byte Byte Byte Figure Accessing Accumulators S7-200 Programmable Controller System Manual Special Memory: bits provide means communicating information between your program. these bits select control some special functions S7-200 CPU, such that turns first scan cycle, that toggles fixed rate, that shows status math operational instructions. (For more information about bits, Appendix access bits bits, bytes, words, double words: Bit: Byte, Word, Double Word: SM[byte address].[bit address] SM[size][starting byte address] SM0.1 SMB86 Local Memory Area: S7-200 provides bytes local memory which used scratchpad memory passing formal parameters subroutines. programming either FBD, STEP 7-Micro/WIN reserves last four bytes local memory use. program STL, bytes memory accessible, recommended that last four bytes memory. Local memory similar memory with major exception. memory global scope while memory local scope. term global scope means that same memory location accessed from program entity (main program, subroutines, interrupt routines). term local scope means that memory allocation associated with particular program entity. S7-200 allocates bytes memory main program, bytes each subroutine nesting level, bytes interrupt routines. allocation memory main program cannot accessed from subroutines from interrupt routines. subroutine cannot access memory allocation main program, interrupt routine, another subroutine. Likewise, interrupt routine cannot access memory allocation main program subroutine. allocation memory made S7-200 as-needed basis. This means that while main portion program being executed, memory allocations subroutines interrupt routines exist. time that interrupt occurs subroutine called, local memory allocated required. allocation memory might reuse same memory locations different subroutine interrupt routine. memory initialized S7-200 time allocation might contain value. When pass formal parameters subroutine call, values parameters being passed placed S7-200 appropriate memory locations called subroutine. memory locations, which receive value result formal parameter passing step, will initialized might contain value time allocation. Bit: Byte, Word, Double Word: L[byte address].[bit address] L[size] [starting byte address] L0.0 LB33 Concepts Chapter Analog Inputs: S7-200 converts analog value (such temperature voltage) into word-length (16-bit) digital value. access these values area identifier (AI), size data (W), starting byte address. Since analog inputs words always start even-number bytes (such access them with even-number byte addresses (such AIW0, AIW2, AIW4). Analog input values read-only values. Format: AIW[starting byte address] AIW4 Analog Outputs: S7-200 converts word-length (16-bit) digital value into current voltage, proportional digital value (such current voltage). write these values area identifier (AQ), size data (W), starting byte address. Since analog outputs words always start even-number bytes (such write them with even-number byte addresses (such AQW0, AQW2, AQW4). Analog output values write-only values. Format: AQW[starting byte address] AQW4 Sequence Control Relay (SCR) Memory Area: SCRs bits used organize machine operations steps into equivalent program segments. SCRs allow logical segmentation control program. access bits bits, bytes, words, double words. Bit: Byte, Word, Double Word: S[byte address].[bit address] S[size][starting byte address] S3.1 Format Real Numbers Real floating-point) numbers represented 32-bit, single-precision numbers, whose format described ANSI/IEEE 754-1985 standard. Figure 4-8. Real numbers accessed double-word lengths. S7-200, floating point numbers accurate decimal places. Therefore, specify maximum decimal places when entering floating-point constant. Sign Exponent Mantissa Figure Format Real Number Accuracy when Calculating Real Numbers Calculations that involve long series values including very large very small numbers produce inaccurate results. This occur numbers differ power where example: S7-200 Programmable Controller System Manual Format Strings string sequence characters, with each character being stored byte. first byte string defines length string, which number characters. Figure shows format string. string have length characters, plus length byte, maximum length string bytes. Length Character Character Character Character Character Byte Byte Byte Byte Byte Byte Figure Format Strings Specifying Constant Value S7-200 Instructions constant value many S7-200 instructions. Constants bytes, words, double words. S7-200 stores constants binary numbers, which then represented decimal, hexadecimal, ASCII, real number (floating point) formats. Table 4-2. Table Decimal Hexadecimal Binary ASCII Real Representation Constant Values Format [decimal value] 16#[hexadecimal value] 2#[binary number] '[ASCII text]' ANSI/IEEE 754-1985 Sample 20047 16#4E4F 2#1010_0101_1010_0101 'Text goes between single quotes.' +1.175495E-38 (positive) -1.175495E-38 (negative) Representation S7-200 does support "data typing" data checking (such specifying that constant stored integer, signed integer, double integer). example, instruction value VW100 signed integer value, while Exclusive instruction same value VW100 unsigned binary value. Concepts Chapter Addressing Local Expansion local provided provides fixed addresses. points S7-200 connecting expansion modules right side CPU, forming chain. addresses points module determined type position module chain, with respect preceding input output module same type. example, output module does affect addresses points input module, vice versa. Likewise, analog modules affect addressing digital modules, vice versa. Digital expansion modules always reserve process-image register space increments eight bits (one byte). module does provide physical point each each reserved byte, these unused bits cannot assigned subsequent modules chain. input modules, unused bits reserved bytes zero with each input update cycle. Analog expansion modules always allocated increments points. module does provide physical each these points, these points lost available assignment subsequent modules chain. Figure 4-10 provides example numbering particular hardware configuration. gaps addressing (shown gray italic text) cannot used your program. I0.0 I0.1 I0.2 I0.3 I0.4 I0.5 I0.6 I0.7 I1.0 I1.1 I1.2 I1.3 I1.4 I1.5 I1.6 I1.7 Q0.0 Q0.1 Q0.2 Q0.3 Q0.4 Q0.5 Q0.6 Q0.7 Q1.0 Q1.1 Q1.2 Q1.3 Q1.4 Q1.5 Q1.6 Q1.7 Module I2.0 I2.1 I2.2 I2.3 I2.4 I2.5 I2.6 I2.7 Q2.0 Q2.1 Q2.2 Q2.3 Q2.4 Q2.5 Q2.6 Q2.7 Module I3.0 I3.1 I3.2 I3.3 I3.4 I3.5 I3.6 I3.7 Analog Analog Module AIW0 AIW2 AIW4 AIW6 AQW0 AQW2 Module Q3.0 Q3.1 Q3.2 Q3.3 Q3.4 Q3.5 Q3.6 Q3.7 Analog Analog Module AIW8 AIW10 AIW12 AIW14 AQW4 AQW6 Expansion Local Figure 4-10 Sample Addresses Local Expansion (CPU 224) S7-200 Programmable Controller System Manual Using Pointers Indirect Addressing S7-200 Memory Areas Indirect addressing uses pointer access data memory. Pointers double word memory locations that contain address another memory location. only memory locations, memory locations, accumulator registers (AC1, AC2, AC3) pointers. create pointer, must Move Double Word instruction move address indirectly addressed memory location pointer location. Pointers also passed subroutine parameter. S7-200 allows pointers access following memory areas: (current value only), (current value only). cannot indirect addressing access individual access memory areas. indirectly access data memory address, create pointer that location entering ampersand memory location addressed. input operand instruction must preceded with ampersand signify that address memory location, instead contents, moved into location identified output operand instruction (the pointer). Entering asterisk front operand instruction specifies that operand pointer. shown Figure 4-11, entering *AC1 specifies that pointer word-length value being referenced Move Word (MOVW) instruction. this example, values stored both VB200 VB201 moved accumulator AC0. V199 address VW200 MOVD &VW200, Creates pointer moving address VB200 (address initial byte VW200) AC1. V200 V201 V202 V203 1234 MOVW *AC1, Moves word value pointed AC0. Figure 4-11 Creating Using Pointer shown Figure 4-12, change value pointer. Since pointers 32-bit values, double-word instructions modify pointer values. Simple mathematical operations, such adding incrementing, used modify pointer values. V199 V200 V201 V202 V203 address VW200 MOVD &VW200, Creates pointer moving address VB200 (address VW200's initial byte) AC1. 1234 MOVW *AC1, Moves word value pointed (VW200) AC0. V199 V200 V201 address VW202 Adds accumulator point next word location. V202 V203 5678 MOVW *AC1, Moves word value pointed (VW202) AC0. Figure 4-12 Modifying Pointer Remember adjust size data that accessing: access byte, increment pointer value access word current value timer counter, increment pointer value access double word, increment pointer value Concepts Chapter Sample Program Using Offset Access Data Memory This example uses LD10 pointer address VB0. then increment pointer offset stored VD1004. LD10 then points another address memory (VB0 offset). value stored memory address pointed LD10 then copied VB1900. changing value VD1004, access memory location. Network //How offset read value location: //1. Load starting address memory pointer. //2. offset value pointer. //3. Copy value from memory location (offset) VB1900. MOVD MOVB SM0.0 &VB0, LD10 VD1004, LD10 *LD10, VB1900 Sample Program Using Pointer Access Data Table This example uses LD14 pointer recipe stored table recipes that begins VB100. this example, VW1008 stores index specific recipe table. each recipe table bytes long, multiply index obtain offset starting address specific recipe. adding offset pointer, access individual recipe from table. this example, recipe copied bytes that start VB1500. Network //How transfer recipe from table recipes: Each recipe bytes long. index parameter (VW1008) identifies recipe loaded. //1. Create pointer starting address recipe table. //2. Convert index recipe double-word value. //3. Multiply offset accommodate size each recipe. //4. adjusted offset pointer. //5. Transfer selected recipe VB1500 through VB1549. MOVD SM0.0 &VB100, LD14 VW1008, LD18 +50, LD18 LD18, LD14 *LD14, VB1500, S7-200 Programmable Controller System Manual Understanding S7-200 Saves Restores Data S7-200 provides variety safeguards ensure that your program, program data, configuration data your S7-200 properly retained. S7-200 provides super capacitor that maintains integrity after power been removed. Depending model S7-200, super capacitor maintain several days. RAM: maintained super capacitor optional battery cartridge S7-200 EEPROM: permanent storage Program block System block memory memory Timer Counter current values Forced values Program block System block Data block memory (permanent area) Forced values S7-200 provides EEPROM store permanently your program, user-selected data areas, configuration data. S7-200 also supports optional battery cartridge that extends amount time that maintained after power been removed from S7-200. battery cartridge provides power only after super capacitor been drained. Figure 4-13 Storage Areas S7-200 Downloading Uploading Elements Your Project Your project consists three elements: program block, data block (optional), system block (optional). Figure 4-14 shows project downloaded S7-200. When download project, elements downloaded project stored area. S7-200 also automatically copies user program, data block, system block EEPROM permanent storage. Program block System block memory memory Timer Counter current values Forced values Program block System block Data block Program block System block Data block: maximum memory range S7-200 Program block System block Data block memory (permanent area) Forced values EEPROM Figure 4-14 Downloading Project S7-200 Figure 4-15 shows project uploaded from S7-200. When upload project your computer, S7-200 uploads system block from uploads program block data block from EEPROM. System block Program block Data block Program block System block memory memory Timer Counter current values Forced values S7-200 Program block System block Data block memory (permanent area) Forced values EEPROM Figure 4-15 Uploading Project from S7-200 Concepts Chapter Saving Retentive Memory Area Power Loss configured first bytes memory (MB0 MB13) retentive, these bytes permanently saved EEPROM event that S7-200 loses power. shown Figure 4-16, S7-200 moves these retentive areas memory EEPROM. default setting first bytes memory non-retentive. default disables save that normally occurs when power S7-200. S7-200 Program block System block memory memory Timer Counter current values Forced values MB13 configured retentive) Program block System block Data block memory (permanent area) Forced values EEPROM Figure 4-16 Saving Memory Power Loss Restoring Data After Power power S7-200 restores program block system block from EEPROM memory, shown Figure 4-17. Also power S7-200 checks verify that super capacitor successfully maintained data stored memory. successfully maintained, retentive areas left unchanged. retentive non-retentive areas memory restored from corresponding data block EEPROM. contents were maintained (such after extended power failure), S7-200 clears (including both retentive non-retentive ranges) sets Retentive Data Lost memory (SM0.2) first scan cycle following power then copies data stored EEPROM RAM. S7-200 Program block System block memory memory Timer Counter current values Forced values Program block System block Data block memory Forced values Program block System block Data block memory (permanent area) Forced values program data successfully maintained, copies data block non-retentive areas memory RAM. program data maintained, copies data block memory (MB0 MB13), defined retentive. Sets other non-retentive areas memory Figure 4-17 Restoring Data after Power EEPROM S7-200 Programmable Controller System Manual Storing Your Program Memory Cartridge S7-200 supports optional memory cartridge that provides portable EEPROM storage your program. S7-200 stores following elements memory cartridge: program block, data block, system block, forced values. copy your program memory cartridge from only when S7-200 powered STOP mode memory cartridge installed. install remove memory cartridge while S7-200 powered Caution Electrostatic discharge damage memory cartridge receptacle S7-200 CPU. Make contact with grounded conductive and/or wear grounded wrist strap when handle cartridge. Store cartridge conductive container. install memory cartridge, remove plastic slot cover from S7-200 insert memory cartridge slot. memory cartridge keyed proper installation. Copying Your Program Memory Cartridge After installing memory cartridge, following procedure copy program: S7-200 STOP mode. program already been downloaded S7-200, download program. Select Program Memory Cartridge menu command copy program memory cartridge. Figure 4-18 shows elements memory that stored memory cartridge. Optional: Remove memory cartridge replace cover S7-200. S7-200 Program block System block memory memory Timer Counter current values Forced values Program block System block Data block memory (permanent area) Forced values System block Memory Cartridge Program block Data block Forced values EEPROM Figure 4-18 Copying Memory Cartridge Restoring Program from Memory Cartridge transfer program from memory cartridge S7-200, must cycle power S7-200 with memory cartridge installed. Notice Powering S7-200 with blank memory cartridge memory cartridge that programmed different model S7-200 could cause error. Memory cartridges that were programmed lower model number read higher model number CPU. However, opposite true. example, memory cartridges that were programmed read 224, memory cartridges that were programmed rejected 222. Remove memory cartridge turn power S7-200. After power memory cartridge then inserted reprogrammed, required. Concepts Chapter shown Figure 4-19, S7-200 performs following tasks after cycle power with memory cartridge installed: contents memory cartridge differ from contents EEPROM, S7-200 clears RAM. S7-200 copies contents memory cartridge RAM. S7-200 copies program block, system block, data block EEPROM. Program block System block Data block Forced values Memory Cartridge S7-200 Program block System block memory memory Program block System block Data block Forced values Program block System block Data block memory (permanent area) Forced values Timer Counter other areas memory current values Forced values EEPROM Figure 4-19 Restoring from Memory Cartridge Selecting Operating Mode S7-200 S7-200 modes operation: STOP mode mode. status front indicates current mode operation. STOP mode, S7-200 executing program, download program configuration. mode, S7-200 running program. S7-200 provides mode switch changing mode operation. mode switch (located under front access door S7-200) manually select operating mode: setting mode switch STOP mode stops execution program; setting mode switch mode starts execution program; setting mode switch TERM (terminal) mode does change operating mode. power cycle occurs when mode switch either STOP TERM, S7-200 goes automatically STOP mode when power restored. power cycle occurs when mode switch RUN, S7-200 goes mode when power restored. STEP 7-Micro/WIN allows change operating mode online S7-200. enable software change operating mode, must manually mode switch S7-200 either TERM RUN. STOP menu commands associated buttons toolbar change operating mode. insert STOP instruction your program change S7-200 STOP mode. This allows halt execution your program based program logic. more information about STOP instruction, Chapter S7-200 Programmable Controller System Manual Using Your Program Save Memory EEPROM save value (byte, word, double word) stored location memory area EEPROM. Save-to-EEPROM operation typically increases scan time maximum value written Save operation overwrites previous value stored memory area EEPROM. Save-to-EEPROM operation does update data memory cartridge. Since number Save operations EEPROM limited (100,000 minimum, 1,000,000 typical), should ensure that only necessary values saved. Otherwise, EEPROM wear fail. Typically, should perform Save operations occurrence specific events that occur rather infrequently. example, scan time S7-200 value saved once scan, EEPROM would last minimum 5,000 seconds, which less than hour half. other hand, value were saved once hour, EEPROM would last minimum years. Copying Memory EEPROM Special Memory Byte (SMB31) commands S7-200 copy value memory memory area EEPROM. Special Memory Word (SMW32) stores address location value that copied. Figure 4-20 shows format SMB31 SMW32. following steps program S7-200 save write specific value memory: Load memory address value saved SMW32. Load size data SM31.0 SM31.1, shown Figure 4-20. SM31.7 SMW32 SMB31 Save EEPROM: Size value saved: byte byte word double word resets SM31.7 after each save operation. every scan cycle, S7-200 checks SM31.7; SM31.7 equals specified value saved EEPROM. operation complete when S7-200 resets SM31.7 SM31 memory address Specify memory address offset from Figure 4-20 SMB31 SMW32 change value memory until save operation complete. Sample Program: Copying Memory EEPROM This example transfers VB100 EEPROM. rising edge I0.0, another transfer progress, loads address memory location transferred SMW32. selects amount memory transfer (1=Byte; 2=Word; 3=Double Word Real). then sets SM31.7 have S7-200 transfer data scan. S7-200 automatically resets SM31.7 when transfer complete. Network MOVW MOVB I0.0 SM31.7 +100, SMW32 SMB31 SM31.7, //Transfer memory location (VB100) //to EEPROM Concepts Chapter Features S7-200 S7-200 provides several special features that allow customize S7-200 functions better your application. S7-200 Allows Your Program Immediately Read Write S7-200 instruction provides instructions that immediately read from write physical I/O. These immediate instructions allow direct access actual input output point, even though image registers normally used either source destination accesses. corresponding process-image input register location modified when immediate instruction access input point. corresponding process-image output register location updated simultaneously when immediate instruction access output point. S7-200 handles reads analog inputs immediate data, unless enable analog input filtering. When write value analog output, output updated immediately. usually advantageous process-image register rather than directly access inputs outputs during execution your program. There three reasons using image registers: sampling inputs start scan synchronizes freezes values inputs program execution phase scan cycle. outputs updated from image register after execution program complete. This provides stabilizing effect system. Your program access image register much more quickly than access points, allowing faster execution program. points entities must accessed bits bytes, access image register bits, bytes, words, double words. Thus, image registers provide additional flexibility. S7-200 Allows Your Program Interrupt Scan Cycle interrupts, routines associated with each interrupt event stored part program. interrupt routines executed part normal scan cycle, executed when interrupt event occurs (which could point scan cycle). Interrupts serviced S7-200 first-come-first-served basis within their respective priority assignments. Interrupt instructions Chapter more information. S7-200 Programmable Controller System Manual S7-200 Allows Allocate Processing Time Communications Tasks configure percentage scan cycle dedicated processing communications requests that associated with mode edit compilation execution status. (Run mode edit execution status options provided STEP 7-Micro/WIN make debugging your program easier.) increase percentage time that dedicated processing communications requests, increase scan time, which makes your control process more slowly. default percentage scan dedicated processing communications requests 10%. This setting chosen provide reasonable compromise processing compilation status operations while minimizing impact your control process. adjust this value increments maximum 50%. scan cycle time-slice background communications: Select View Component System Block menu command click Background Time tab. Edit properties communications background time click Download modified system block S7-200. S7-200 Figure 4-21 Communications Background Time S7-200 Allows States Digital Outputs Stop Mode output table S7-200 allows determine whether state digital output points known values upon transition STOP mode, leave outputs state they were before transition STOP mode. output table part system block that downloaded stored S7-200 applies only digital outputs. Select View Component System Block menu command click Output Table tab. freeze outputs their last state, select Freeze Outputs check box. copy table values outputs, enter output table values clicking checkbox each output want after run-to-stop transition. (The default values table zeroes.) Click save your selections. Download modified system block S7-200. Figure 4-22 Configuring Output Table Concepts Chapter S7-200 Allows Define Memory Retained Loss Power define retentive ranges select areas memory want retain through power cycles. define ranges addresses following memory areas retentive: timers, only retentive timers (TONR) retained. default setting first bytes Memory non-retentive. Only current values timers counters retained: timer counter bits retentive. Changing range MB13 retentive enables special feature that automatically saves these locations EEPROM power down. define retentive memory: Select View Component System Block menu command click Retentive Ranges tab. Select ranges memory retained following loss power click Download modified system block S7-200. Figure 4-23 Retentive Memory S7-200 Allows Filter Digital Inputs S7-200 allows select input filter that defines delay time (selectable from 12.8 some local digital input points. This delay helps filter noise input wiring that could cause inadvertent changes states inputs. input filter part system block that downloaded stored S7-200. default filter time shown Figure 4-24, each delay specification applies groups input points. configure delay times input filter: Select View Component System Block menu command click Input Filters tab. Enter amount delay each group inputs click Download modified system block S7-200. Figure 4-24 Configuring Input Filters digital input filter affects input value seen instruction reads, input interrupts, pulse catches. Depending your filter selection, your program could miss interrupt event pulse catch. high speed counters count events unfiltered inputs. S7-200 Programmable Controller System Manual S7-200 Allows Filter Analog Inputs S7-200 allows select software filtering individual analog inputs. filtered value average value preselected number samples analog input. filter specification (number samples deadband) same analog inputs which filtering enabled. filter fast response feature allow large changes quickly reflected filter value. filter makes step function change latest analog input value when input exceeds specified change from current value. This change, called deadband, specified counts digital value analog input. default configuration enable filtering analog inputs. Select View Component System Block menu command click Analog Input Filters tab. Select analog inputs that want filter, number samples, deadband. Click Download modified system block S7-200. Figure 4-25 Analog Input Filter analog filter with modules that pass digital information alarm indications analog words. Always disable analog filtering RTD, Thermocouple, AS-Interface Master modules. S7-200 Allows Catch Pulses Short Duration S7-200 provides pulse catch feature which used some local digital input points. pulse catch feature allows capture high-going pulses low-going pulses that such short duration that they would always seen when S7-200 reads digital inputs beginning scan cycle. When pulse catch enabled input, change state input latched held until next input cycle update. This ensures that pulse which lasts short period time caught held until S7-200 reads inputs. individually enable pulse catch operation each local digital inputs. access pulse catch configuration screen: Select View Component System Block menu command click Pulse Catch Bits tab. Click corresponding check click Download modified system block S7-200. Figure 4-26 Pulse Catch Concepts Chapter Figure 4-27 shows basic operation S7-200 with without pulse catch enabled. Scan cycle Input update Next scan cycle Input update Physical Input Output from pulse catch Disabled Enabled Figure 4-27 S7-200 misses this pulse because input turned before S7-200 updated process-image input register S7-200 catches pulse physical input Operation S7-200 with Pulse Catch Feature Enabled Disabled Because pulse catch function operates input after passes through input filter, must adjust input filter time that pulse removed filter. Figure 4-28 shows block diagram digital input circuit. Optical Isolation External Digital Input Figure 4-28 Digital Input Circuit Digital Input Filter Pulse Catch Pulse Catch Enable Input S7-200 Figure 4-29 shows response enabled pulse catch function various input conditions. have more than pulse given scan, only first pulse read. have multiple pulses given scan, should rising/falling edge interrupt events. (For listing interrupt events, Table 6-44.) Scan cycle Input update Next scan cycle Input update Input pulse catch Output from pulse catch Input pulse catch Output from pulse catch Input pulse catch Output from pulse catch Figure 4-29 Responses Pulse Catch Function Various Input Conditions S7-200 Programmable Controller System Manual S7-200 Provides Password Protection models S7-200 provide password protection restricting access specific functions. password authorizes access functions memory: without password, S7-200 provides unrestricted access. When password protected, S7-200 limits restricted operations according configuration provided when password installed. password case sensitive. shown Table 4-3, S7-200 provides three levels access restriction. Each level allows certain functions accessible without password. three levels access, entering correct password provides access functions. default condition S7-200 level restriction). Entering password over network does compromise password protection S7-200. Table Restricting Access S7-200 Level Access Allowed Function Read write user data Start, stop, restart Read write time-of-day clock Upload user program, data, configuration Download execution status Delete program block, data block, system block Force data execute single/multiple scan Copy memory cartridge Write outputs STOP mode Level Access Allowed Level Access Allowed Access Allowed Access Allowed Password required Access Allowed Password required Having user authorized access restricted functions does authorize other users access those functions. Only user allowed unrestricted access S7-200 time. After enter password, authorization level that password remains effective minute after programming device been disconnected from S7-200. Always exit STEP 7-Micro/WIN before disconnecting cable prevent another user from accessing privileges programming device. Configuring Password S7-200 System Block dialog (Figure 4-30) allows configure password S7-200: Select View Component System Block menu command display System Block dialog click Password tab. Select appropriate level access S7-200. Enter verify password. Click Download modified system block S7-200. Figure 4-30 Creating Password Concepts Chapter Recovering from Lost Password forget password, must clear memory S7-200 reload your program. Clearing memory puts S7-200 STOP mode resets S7-200 factory-set defaults, except network address, baud rate, time-of-day clock. clear your program S7-200: Select Clear menu command display Clear dialog box. Select three blocks confirm your action clicking password been configured, STEP 7-Micro/WIN displays password-authorization dialog box. clear password, enter CLEARPLC password-authorization dialog continue Clear operation. (The CLEARPLC password case sensitive.) Clear operation does remove program from memory cartridge. Since memory cartridge stores password along with program, must also reprogram memory cartridge remove lost password. Warning Clearing S7-200 memory causes outputs turn case analog output, frozen specific value). S7-200 connected equipment when clear memory, changes state outputs transmitted equipment. configured "safe state" outputs different from factory settings, changes outputs could cause unpredictable operation your equipment, which turn could cause death serious injury personnel, and/or damage equipment. Always follow appropriate safety precautions ensure that your process safe state before clearing S7-200 memory. S7-200 Provides Analog Adjustment Potentiometers analog adjustment potentiometers located under front access cover module. adjust these potentiometers increase decrease values that stored bytes Special Memory (SMB). These read-only values used program variety functions, such updating current value timer counter, entering changing preset values, setting limits. small screwdriver make adjustments: turn potentiometer clockwise right) increase value, counterclockwise left) decrease value. SMB28 holds digital value that represents position analog adjustment SMB29 holds digital value that represents position analog adjustment analog adjustment nominal range repeatability counts. Sample Program Referencing Value Entered with Analog Adjustment Potentiometers Network //Read analog adjustment (SMB28). //Save value integer VW100. I0.0 SMB28, VW100 //Use integer value (VW100) preset timer. Network Q0.0 T33, VW100 //Turn Q0.0 when reaches preset value. Network Q0.0 S7-200 Programmable Controller System Manual S7-200 Provides High-speed High-Speed Counters S7-200 provides integrated high-speed counter functions that count high speed external events without degrading performance S7-200. Appendix rates supported your model. Each counter dedicated inputs clocks, direction control, reset, start, where these functions supported. select different quadrature modes varying counting rate. more information high-speed counters, Chapter High-Speed Pulse Output S7-200 supports high-speed pulse outputs, with outputs Q0.0 Q0.1 generating either high-speed pulse train output (PTO) pulse width modulation (PWM). function provides square wave (50% duty cycle) output specified number pulses (from 4,294,967,295 pulses) specified cycle time either microsecond millisecond increments either from 65,535 from 65,535 ms). program function produce either train pulses pulse profile consisting multiple trains pulses. example, pulse profile control stepper motor through simple ramp run, ramp down sequence more complicated sequences. pulse profile consist segments with segment corresponding ramp ramp down operation. function provides fixed cycle time with variable duty cycle output, with cycle time pulse width specified either microsecond millisecond increments. cycle time range either from 65,535 from 65,535 pulse width time range either from 65,535 from 65,535 When pulse width equal cycle time, duty cycle percent output turned continuously. When pulse width zero, duty cycle percent output turned off. more information high-speed pulse output instruction, Chapter Programming Concepts, Conventions, Features S7-200 continuously executes your program control task process. STEP 7-Micro/WIN create this program download S7-200. STEP 7-Micro/WIN provides variety tools features designing, implementing, debugging your program. This Chapter Guidelines Designing Micro System Basic Elements Program Using STEP 7-Micro/WIN Create Your Programs Choosing Between SIMATIC 1131-3 Instruction Sets Understanding Conventions Used Program Editors Using Wizards Help Create Your Control Program Handling Errors S7-200 Assigning Addresses Initial Values Data Block Editor Using Symbol Table Symbolic Addressing Variables Using Local Variables Using Status Chart Monitor Your Program Creating Instruction Library Features Debugging Your Program S7-200 Programmable Controller System Manual Guidelines Designing Micro System There many methods designing Micro system. following general guidelines apply many design projects. course, must follow directives your company's procedures accepted practices your training location. Partition Your Process Machine Divide your process machine into sections that have level independence from each other. These partitions determine boundaries between controllers influence functional description specifications assignment resources. Create Functional Specifications Write descriptions operation each section process machine. Include following topics: points, functional description operation, states that must achieved before allowing action each actuator (such solenoids, motors, drives), description operator interface, interfaces with other sections process machine. Design Safety Circuits Identify equipment requiring hard-wired logic safety. Control devices fail unsafe manner, producing unexpected startup change operation machinery. Where unexpected incorrect operation machinery could result physical injury people significant property damage, consideration should given electro-mechanical overrides which operate independently S7-200 prevent unsafe operations. following tasks should included design safety circuits: Identify improper unexpected operation actuators that could hazardous. Identify conditions that would assure operation hazardous, determine detect these conditions independently S7-200. Identify S7-200 affect process when power applied removed, when errors detected. This information should only used designing normal expected abnormal operation, should relied safety purposes. Design manual electro-mechanical safety overrides that block hazardous operation independent S7-200. Provide appropriate status information from independent circuits S7-200 that program operator interfaces have necessary information. Identify other safety-related requirements safe operation process. Specify Operator Stations Based requirements functional specifications, create drawings operator stations. Include following items: Overview showing location each operator station relation process machine Mechanical layout devices, such display, switches, lights, operator station Electrical drawings with associated S7-200 expansion module Programming Concepts, Conventions, Features Chapter Create Configuration Drawings Based requirements functional specification, create configuration drawings control equipment. Include following items: Overview showing location each S7-200 relation process machine Mechanical layout S7-200 expansion modules (including cabinets other equipment) Electrical drawings each S7-200 expansion module (including device model numbers, communications addresses, addresses) Create List Symbolic Names (optional) choose symbolic names addressing, create list symbolic names absolute addresses. Include only physical signals, also other elements used your program. Basic Elements Program program block composed executable code comments. executable code consists main program subroutines interrupt routines. code compiled downloaded S7-200; program comments not. organizational elements (main program, subroutines, interrupt routines) structure your control program. following example shows program that includes subroutine interrupt routine. This sample program uses timed interrupt reading value analog input every Example:Basic Elements Program Network CALL Network //On first scan, call subroutine SM0.1 SBR_0 //Set interval //for timed interrupt. //Enable interrupt SM0.0 100, SMB34 INT_0, MOVB ATCH Network MOVW //Sample Analog Input SM0.0 AIW4,VW100 S7-200 Programmable Controller System Manual Main Program main body program contains instructions that control your application. S7-200 executes these instructions sequentially, once scan cycle. main program also referred OB1. Subroutines These optional elements your program executed only when called: main program, interrupt routine, another subroutine. Subroutines useful cases where want execute function repeatedly. Rather than rewriting logic each place main program where want function occur, write logic once subroutine call subroutine many times needed during main program. Subroutines provide several benefits: Using subroutines reduces overall size your program. Using subroutines decreases your scan time because have moved code main program. S7-200 evaluates code main program every scan cycle, whether code executed not, S7-200 evaluates code subroutine only when call subroutine, does evaluate code during scans which subroutine called. Using subroutines creates code that portable. isolate code function subroutine, then copy that subroutine into other programs with little rework. Using memory addresses limit portability your subroutine, because possible memory address assignment from program conflict with assignment another program. Subroutines that local variable table memory) address assignments, contrast, highly portable because there concern about address conflicts between subroutine another part program when using local variables. Interrupt Routines These optional elements your program react specific interrupt events. design interrupt routine handle pre-defined interrupt event. Whenever specified event occurs, S7-200 executes interrupt routine. interrupt routines called your main program. associate interrupt routine with interrupt event, S7-200 executes instructions interrupt routine only each occurrence interrupt event. Because possible predict when S7-200 might generate interrupt, desirable limit number variables that used both interrupt routine elsewhere program. local variable table interrupt routine ensure that your interrupt routine uses only temporary memory does overwrite data used somewhere else your program. There number programming techniques ensure that data correctly shared between your main program interrupt routines. These techniques described Chapter with Interrupt instructions. Other Elements Program Other blocks contain information S7-200. choose download these blocks when download your program. System Block System Block system block allows configure different hardware options S7-200. Data Block Data Block data block stores values different variables memory) used your program. data block enter initial values data. Programming Concepts, Conventions, Features Chapter Using STEP 7-Micro/WIN Create Your Programs open STEP 7-Micro/WIN, double-click STEP 7-Micro/WIN icon, select Start SIMATIC STEP MicroWIN menu command. shown Figure 5-1, STEP 7-Micro/WIN project window provides convenient working space creating your control program. toolbars provide buttons shortcuts frequently used menu commands. view hide toolbars. navigation presents groups icons accessing different programming features STEP 7-Micro/WIN. instruction tree displays project objects instructions creating your control program. drag drop individual instructions from tree into your program, double-click instruction insert current location cursor program editor. program editor contains program logic local variable table where assign symbolic names temporary local variables. Subroutines interrupt routines appear tabs bottom program editor window. Click tabs move between subroutines, interrupts, main program. Program Editor Instruction tree Navigation Figure STEP 7-Micro/WIN Program Editor STEP 7-Micro/WIN provides three editors creating your program: Ladder Logic (LAD), Statement List (STL), Function Block Diagram (FBD). With some restrictions, programs written these program editors viewed edited with other program editors. Features Editor editor displays program text-based language. editor allows create control programs entering instruction mnemonics. editor also allows create programs that could otherwise create with editors. This because programming native language S7-200, rather than graphical editor where some restrictions must applied order draw diagrams correctly. shown Figure 5-2, this text-based concept very similar assembly language programming. S7-200 executes each instruction order dictated program, from bottom, then restarts top. uses logic stack resolve control logic. insert instructions handling stack operations. Figure I0.0 I0.1 Q1.0 //Read input //AND with another input //Write value output Sample Program Consider these main points when select editor: most appropriate experienced programmers. sometimes allows solve problems that cannot solve very easily with editor. only editor with SIMATIC instruction set. While always editor view edit program that created with editors, reverse always true. cannot always editors display program that written with editor. S7-200 Programmable Controller System Manual Features Editor editor displays program graphical representation similar electrical wiring diagrams. Ladder programs allow program emulate flow electric current from power source through series logical input conditions that turn enable logical output conditions. program includes left power rail that energized. Contacts that closed allow energy flow through them next element, contacts that open block that energy flow. logic separated into networks. program executed network time, from left right then bottom dictated program. Figure shows example program. various instructions represented graphic symbols include three basic forms. Contacts represent logic input conditions such switches, buttons, internal conditions. Coils usually represent logic output results such lamps, motor starters, interposing relays, internal output conditions. Boxes represent additional instructions, such timers, counters, math instructions. Figure Sample Program Consider these main points when select editor: Ladder logic easy beginning programmers use. Graphical representation easy understand popular around world. editor used with both SIMATIC 1131-3 instruction sets. always editor display program created with SIMATIC editor. Features Editor editor displays program graphical representation that resembles common logic gate diagrams. There contacts coils found editor, there equivalent instructions that appear instructions. Figure shows example program. does concept left right power rails; therefore, term "power flow" used express analogous concept control flow through logic blocks. Figure Sample Program logic path through elements called power flow. origin power flow input destination power flow output assigned directly operand. program logic derived from connections between these instructions. That output from instruction (such box) used enable another instruction (such timer) create necessary control logic. This connection concept allows solve wide variety logic problems. Consider these main points when select editor: graphical logic gate style representation good following program flow. editor used with both SIMATIC 1131-3 instruction sets. always editor display program created with SIMATIC editor. Programming Concepts, Conventions, Features Chapter Choosing Between SIMATIC 1131- Instruction Sets Most PLCs offer similar basic instructions, there usually small differences from vendor vendor appearance, operation, forth. Over last several years, International Electrotechnical Commission (IEC) developed emerging global standard that specifically relates many aspects programming. This standard encourages different manufacturers offer instructions that same both appearance operation. Your S7-200 offers instruction sets that allow solve wide variety automation tasks. instruction complies with 1131-3 standard programming, SIMATIC instruction designed specifically S7-200. When STEP 7-Micro/WIN mode, displays diamond Instruction Tree beside instructions that defined 1131-3 standard. There differences between SIMATIC instruction instruction set: instruction restricted those instructions that standard among vendors. Some instructions that normally included SIMATIC standard instructions 1131-3 specification. These still available non-standard instructions, them, program longer strictly 1131-3 compatible. Some instructions accept multiple data formats. This practice often referred overloading. example, rather than have separate ADD_I (Add Integer) ADD_R (Add Real), math boxes, instruction examines format data being added automatically chooses correct instruction S7-200. This save valuable program design time. When instructions, instruction parameters automatically checked proper data format, such signed integer versus unsigned integer. example, error results enter integer value instruction that expected value (on/off). This feature helps minimize programming syntax errors. Consider these points when select either SIMATIC instruction set: SIMATIC instructions usually have shortest execution times. Some instructions might have longer execution times. Some instructions, such timers, counters, multiply, divide, operate differently than their SIMATIC counterparts. three program editors (LAD, STL, FBD) with SIMATIC instruction set. only program editors instructions. operation instructions standard different brands PLCs, knowledge about creating IEC-compliant program leveraged across platforms. While standard defines fewer instructions than available SIMATIC instruction set, always include SIMATIC instructions your program. 1131-3 specifies that variables must declared with type, supports system checking data type. S7-200 Programmable Controller System Manual Understanding Conventions Used Program Editors STEP 7-Micro/WIN uses following conventions program editors: front symbol name (#var1) indicates that symbol local scope. instructions, symbol indicates direct address. operand symbol "?.?" "????" indicates that operand configuration required. programs divided into segments called networks. network ordered arrangement contacts, coils, boxes that connected form complete circuit: short circuits, open circuits, reverse power flow conditions exist. STEP 7-Micro/WIN allows create comments your program network-by-network basis. programming uses network concept segmenting commenting your program. programs networks; however, NETWORK keyword segment your program. Conventions Specific Editor editor, keys your keyboard access contact, box, coil instructions. editor uses following conventions: symbol "->>" open circuit required power flow connection. symbol indicates that output optional power flow instruction that cascaded connected series. symbol ">>" indicates that power flow. Conventions Specific Editor editor, keys your keyboard access AND, instructions. editor uses following conventions: symbol "->>" operand power flow operand indicator. also depict open circuit required power flow connection. symbol indicates that output optional power flow instruction that cascaded connected series. symbols "<<" ">>" indicate that either value power flow. Negation bubbles: logical condition inverted condition operand power flow shown small circle input. Figure 5-5, Q0.0 equal I0.0 I0.1. Negation bubbles only valid Boolean signals which signals, specified parameters power flow. Logical Condition Immediate Condition Figure Conventions Immediate indicators: shown Figure 5-5, editor displays immediate condition Boolean operand with vertical line input instruction. immediate indicator causes immediate read from specified physical input. Immediate operators only valid physical inputs. with input output: with input indicates instruction that independent power flow. number operands expanded inputs instructions. subtract operand tics, keys your keyboard. Programming Concepts, Conventions, Features Chapter General Conventions Programming S7-200 EN/ENO Definition (Enable Boolean input boxes FBD. Power flow must present this input instruction executed. STL, instructions have input, stack value must logic corresponding instruction executed. (Enable Out) Boolean output boxes FBD. power flow input executes function without error, then output passes power flow next element. error detected execution box, then power flow terminated that generated error. STL, there output, instructions that correspond instructions with outputs special bit. This accessible with (AENO) instruction used generate same effect box. EN/ENO operands data types shown valid operands table each instruction because operands same instructions. Table lists these operands data types FBD. These operands apply instructions shown this manual. Table EN/ENO Operands Data Types Inputs/Outputs Operands Power Flow Data Types BOOL BOOL Program Editor Conditional/Unconditional Inputs FBD, coil that dependent upon power flow shown with connection element left side. coil that independent power flow shown with connection directly left power rail. Table shows example both conditional unconditional input. Table Power Flow Instruction that dependent power flow (conditional) Representation Conditional Unconditional Inputs Instruction that independent power flow (unconditional) Instructions without Outputs Boxes that cannot cascade drawn with Boolean outputs. These include Subroutine Call, Jump, Conditional Return instructions. There also ladder coils that only placed le Other recent searchesRT9168 - RT9168 RT9168 Datasheet NJU26203A - NJU26203A NJU26203A Datasheet NJU26203AII - NJU26203AII NJU26203AII Datasheet NJU26203ADVD - NJU26203ADVD NJU26203ADVD Datasheet NJU26203AV - NJU26203AV NJU26203AV Datasheet LBGA156 - LBGA156 LBGA156 Datasheet KTY84-1 - KTY84-1 KTY84-1 Datasheet IL410 - IL410 IL410 Datasheet IL4108 - IL4108 IL4108 Datasheet EM15T - EM15T EM15T Datasheet AT83C5122 - AT83C5122 AT83C5122 Datasheet AT85C5122 - AT85C5122 AT85C5122 Datasheet AT89C5122 - AT89C5122 AT89C5122 Datasheet AT76C711 - AT76C711 AT76C711 Datasheet
Privacy Policy | Disclaimer |