# Art lantern shape PLC Ladder programming and wiring experiment

1. Project the necessary equipment, tools, materials

PLC: FX2N-32MR

2, the training content:
1, project description
The shape of an art lantern demonstration board as shown in Figure 6, A, B, C, D, E, F, G, H for the eight lights, a ring distribution. The control requirements are as follows:
Will start switch K1 close, eight lighting light at the same time, namely abcdefgh light at the same time a second, then eight lighting according to counter clockwise rotate the light seconds, a bright 1s > b 1s > C bright bright 1s > d 1s > e bright bright 1s > f light 1 second g > bright 1s > h light 1 second; next eight lighting and light at the same time 1: abcdefgh and light 1 second; and eight lighting according to clockwise rotate the light 1 second, namely h bright 1 g > light 1 second > f light 1 second, e light in the 1s > d 1s > C bright bright 1s > B bright second, a bright light for 1 second. Then repeat the execution in this order. Press the stop switch K1, all the lights off.

2.2 PLC wiring diagram
According to figure 7 to meet the good line. Note that the COM1 and COM2 are connected, as the same as the rated voltage of the indicator light. Input and then start switch and stop switch.
2.3 program design
Figure 8, PLC operation, the program 9 to 19 step, M11 conduction, due to the step program of 50 to 120, M11 dynamic contact closure, respectively control the Y0 Y7 conduction and lantern abcdefgh lit up at the same time, the due t0 delay 1 seconds, so the abcdefgh lit up at the same time 1 seconds. To 1 seconds, the program step 40 t0 dynamic contact closure, shift instruction execution, implementation turns light, namely abcdefgh turns light, because a second clock t0 closed once, so abcdefgh turns light interval for a second. Step 20 to 29, when the M20 pass, the M101 set, the M101 moving contact with MI2 ~ M19 moving contact with the contact, respectively, turns lit H ~ A, that is, G, F, H, E, D, C, B, A turns lit every second. Step 30 to 39, when the M20 pass, the M101 reset, M101 dynamic break contacts with MI2 ~ M19 dynamic contact contact, respectively, in series lit A ~ H, that is, A, B, C, D, E, F, H, G turns lit every second. At any time will stop the switch K2 closed, in the 114th step, the interval reset command so that M19 ~ M12 all reset, all the lights are not bright.
2.4 run and debug program
(1) the ladder diagram program is entered into the computer, check the power supply is correct.
(2) to debug the program.
A. connected to the PLC power supply, the PLC will be RUN state, the K1 closed, observation of A, B, C, D, E, F, G, H, the light show.
K2 will be closed, A, B, B., C, D, E, F,, G, H, the light show.
(3) debug running record.

# Siemens PLC 200 special sign bits (SM)

Special flags to provide users with some special control function and system information, user‘s special requirements of operations also SM notification system. Special flag is divided into readonly and readwrite in two parts.

Readonly special flag, users can use their contacts, such as:

SM0.0 RUN control, PLC in RUN State, SM0.0 is 1.

SM0.1 initializes the pulse, when the PLC from STOP to RUN, SM0.1 through a scanning cycle.

SM0.2 when the data saved in RAM is lost, SM0.2 through a scanning cycle.

SM0.3 PLC is powered on when entering the RUN SM0.3 through a scanning cycle.

SM0.4 provides a cycle for 1 min, the clock duty ratio is 0.5.

SM0.5 provides a period of 1 s, the clock duty ratio is 0.5.

SM0.6 the bit clock for scanning, the scan reset 1, next scan 0 both cycles. As an input to scan counter.

SM0.7 indicates the position of CPU operation mode switching, 0=TERM,1=RUN. Usually used to start free port communication in the RUN State.

Readable, writable special flags for special control functions, such as SMB30 to the free port, SMB34/SMB35 set for scheduled downtime, SMB36~SMB62 for high speed counter, pulse modulation for pulse output, and SMB66~SMB85, and so on.

# S7-200 PLC Data area

A) digital input and output image area

1. Enter mapping registers (digital input image areas) (I)

Digital input image is S7-200CPU for the input signal state opened up a store. Register identifier for the input image I, at the beginning of each scan cycle, CPU to sample the input points and registers the sample values in the input image.

Enter image register is the digital signals of PLC receives external input window.

Can be bit, byte, Word, double word four ways to access.

(1) press the bits: from I0.0~I15.7, a total of 128 points

(2) press the bytes: from IB0~IB15, a total of 16 bytes

(3) press character: from IW0~IW14, a total of 8 characters

(4) press the double-word: from ID0~ID12, a total of 4 double word

2. The output image register (Q)

Digital output image area is the S7-200CPU for the signal at the output state of a storage area. Register the output image‘s identifier is Q (from Q0.0~Q15.7, a total of 128 points), at the end of each scan cycle, CPU registers of the output image data to output module, which then drive the external load.

Can be bit, byte, Word, double word four ways to access.

(1) press the bits: from Q0.0~I15.7, a total of 128 points

(2) press the bytes: from QB0~QB15, a total of 16 bytes

(3) press character: from QW0~QW14, a total of 8 characters

(4) press the double-word: from QD0~QD12, a total of 4 double word

Note: practically no use of input and output image area of the storage unit can be used as relay.

Analog input image area is the S7-200CPU analog input signal opens a store. S7-200 measurement of analog (such as temperature and pressure) into a 1length (2 bytes) of digital, analog input registers with the image identifier (AI), the length of the data (w) and the bytes of the start address.

From AIW0~AIW30, a total of 16 characters, a total of 16 analog input is allowed.

2. Analog output image area (AQ)

Analog output image area is the S7-200CPU analog output signal to open a store. S7-200 1Word (2 byte, 16-bit) converts the digital proportional current or voltage. Analog output registers with the image identifier (AQ), the length of the data (w) and the bytes of the start address.

From AQW0~AQW30, a total of 16 characters, allowed a total of 16 analog outputs.

(C) the memory variable (v) (the equivalent of auxiliary relays)

PLC program execution process, there will be some intermediate results of the control process, these intermediate also need memory to save the data. Variable storage is designed according to the actual requirements. Variable storage is one of the S7-200CPU set up to save the intermediate variable data stores, represented by v.

Can be bit, byte, Word, double word four ways to access.

(1) press the bits: from V0.0~I5119.7, a total of 40,960 points. CPU221, CPU222, memory only 2048 bytes of the variable, its variable store only to V2047.7.

(2) press the bytes: from VB0~VB5119, a total of 5,120 bytes

(3) press character: from VW0~VW5118, a total of 2,560 words

(4) press the double-word: from VD0~VD5116, a total of 1280 double word

(D) information technology(m)

PLC program execution process, some flags may be used, which also use memory to storage. Memory is designed according to the requirements. Memory is one of the S7-200CPU set up to keep flag data store represented by m. Although the area is called memory, but the data can not only be, but also can be a byte, Word or double word.

(1) press the bits: from M0.0~M31.7, a total of 256 points.

(2) press the bytes: from MB0~MB31, a total of 32 bytes

(3) press character: from MW0~MW30, a total of 16 characters

(4) press the double-word: from MD0~MD28, a total of 8 double word

(E) the control relays in the order (s)

PLC program execution process, the sequence may be used. Sequence control relays are designed according to the characteristics of sequential control and. Control relay is S7-200CPU in order to control relays in the order established a store of data, denoted by s. Control process in order for the organization step process control.

Can be bit, byte, Word, double word four ways to access.

(1) press the bits: from S0.0~S31.7, a total of 256 points.

(2) press the bytes: from SB0~SB31, a total of 32 bytes

(3) press character: from SW0~SW30, a total of 16 characters

(4) press the double-word: from SD0~SD28, a total of 8 double word

(F) local storage area (l) (the equivalent of auxiliary relays)

S7-200PLC 64 bytes of local storage, which can be used as a temporary store for the 60 and passing parameters to the subroutine.

Local and variable storage is very similar, the main difference is that the variable memory is of global and local storage is partially valid. Global refers to the same memory can be accessed by any program (for example, the main program, subroutine, or interrupt). Local guide memory areas associated with specific programs.

Several programs between visits.

Local storage area is a store set up S7-200CPU as a local variable data, represented by l. Data in the region can be bit, byte, Word, double word four ways to access.

(1) press the bits: from L0.0~L63.7, a total of 512 points.

(2) press the bytes: from LB0~LB63, a total of 64 bytes

(3) press character: from LW0~LW62, a total of 32 characters

(4) press the double-word: from LD0~LD60, a total of 16 doubleword

(G) the timer memory area (t)

PLC at work and ultimately need timing, the timer is the realization of PLC timer function of timing equipment. Timer number:

T0、T1、……、T255

S7-200 has 256 timers.

(VIII) counter memory area (c)

PLC at work sometimes requires not only time count may also be required. Counter is counting device of PLC with counting function.

Counter ID:

C0、C1、……、C255

(H) high speed counter (HSC)

Today high speed counter is used to scan faster than CPU events. S7-200 high speed counters not only count the frequency of up to 30kHz.

S7-200 high speed counter there is a 32-bit signed integer to the current value of the counter. To access high-speed counter values, you must give high speed counter address, namely, high speed counter number.

High speed counter number: HSC0, HSC1, … …, HSC5.

S7-200 6 high-speed counters. Where CPU221 and CPU222 only have 4 high-speed counters (HSC0, HSC3, HSC4, HSC5)

(I) the accumulator (AC)

Accumulators can be read/write device like a memory. For example, you can use the accumulator parameters passed to a subroutine, or return from the subroutine parameters and is used to store intermediate data are calculated.

S7-200CPU provides 4 32-bit accumulator (AC0, AC1, AC2, AC3).

Can be byte, Word or double word accumulator to access data in the data. However, as bytes when reading/writing data in the accumulator, read/write only the lowest 8 bits of the accumulator in the 32-bit data data. If it is read/write in Word forms the accumulator data can only read/write in 32-bit accumulator data the low 16 bits of data. Only take the form of double words when reading/writing data in the accumulator, can read and write all 32 bits of data at once.

Because operation of PLC function is separated from the accumulator. Not as occupied as the other memory accumulators.

(J) special storage areas (SM)

Special memory is S7-200PLC the media for passing information between the CPU and the user program. They can reflect the CPU running the various status information, users can use this information to determine the machine‘s operating status, to determine the user what to do, what not to do. These special information storage to storage. Special memory is designed according to the requirements.

1. Special storage areas

It is S7-200PLC to save its State data and established a store, SM said. Special memory data is read write, some are readonly. Special memory data can be a bit or a byte, Word or double word.

(1) press the bits: from SM0.0~SM179.7, a total of 1440 points.

(2) press the bytes: from SM0~SM179, a total of 180 bytes

(3) press character: from SMW0~SMW178, a total of 90 characters

(4) press the double-word: from SMD0~SMD176, a total of 45 double word

Description: special the first 30 bytes of the memory area is readonly.

2. Commonly used special relay and its function

Special storage for CPU and the exchange of information between users, for example, SM0.0 has been the 1 State, SM0.1 only the first scan of the execution of the userprocess cycle for the 1 State. SM0.4 and SM0.5 provide a period of 1min and 1s of the clock pulse. SM1.0, SM1.1 and SM1.2 respectively zero flag, overflow flag and negative signs.

# Siemens new PLC program, data storage cards

MMC card is the new Siemens PLC program, data storage, and present several PLC should be used for the following products:

Order product name
6ES7 314-1AF10-0AB0 new CPU 314
6ES7 new CPU 315-2AG10-0AB0 315-2DP
6ES7 312-5BD00-0AB0 CPU 312C
6ES7 313-5BE00-0AB0 CPU 313C
6ES7 313-6CE00-0AB0 CPU 313C-2DP
6ES7 313-6BE00-0AB0 CPU 313C-2PTP
6ES7 314-6CF00-0AB0 CPU 314C-2DP
6ES7 314-6BF00-0AB0 CPU 314C-2PTP
6ES7 613-1CA00-0AE3 C7 613
6ES7 635-2EC00-0AE3 C7 635 OP
6ES7 635-2EB00-0AE3 C7 635 OP
6ES7 151-7***-0AB0 ET200S with CPU
Note: the above product order number may be slight adjustments in product hardware and software upgrades, product characteristics product name shall prevail.

1. In ordered above products Shi, PLC itself not with MMC card, so to normal using PLC, you must according to you project actual needs ordered a size applies of MMC card, if you of PLC Shang not insert MMC card, you is cannot will STEP7 in the of program and data download down of, while you should note, cannot charged plug pulled MMC card, or will lost program or damaged MMC card.

3. Except the CPU integrated in the SFB/SFCs blocks of MMC among other pieces can be deleted online.

4. For some CPU, new MMC card (6ES7 953-XXX10-0AA0) replace the old version of the MMC card (6ES7 953-XXX00-0AA0), PLC’s OPERATING SYSTEM needs to be upgraded. Upgrades require the use of PG (6ES7798-0BA00-0XA0) or a programmer with USB port (6ES7792-0AA00-0XA0), through STEP7 MANAGER menu feature in Windows PLC/UPDATE OPERATING SYSTEM” will be CPU_HD. UPD files written to the MMC card, CPU_HD. UPD files can be downloaded at www4.ad.Siemens.de get.

5. MMC card as CPU of Mount memory (Load Memory), in for you of CPU selection MMC of when, we recommends you by selected of MMC card must to is greater than is equal to you by selected of CPU work memory of size (work memory), best than work memory big some, but if you of application in the, PLC work Shi to using large of process data, history data, formula data, or control process in the exists more of user program block, and STEP7 function blocks (such as FB41, FB42, and so on), it is recommended that the MMC card using 2-8M, but please note that only 314, 315-2DP, C7 series PLC supports MMC card 8M.

6. MMC card is loaded in-memory, so it is not able to read directly from your PC configuration software in data values on the MMC card (data in the DB), the configuration screen is read PLC data in the RAM memory.

7. Siemens PLC, Siemens must be used on a dedicated MMC cards as listed in the following table, you cannot use the digital camera, mobile phone or PDA and other digital products using genericMMC card.
The order numbers for MMC cards are in the following table:

Micro Memory Card / S7-300 Order number

64 Kbytes                 6ES7 953-8LF11-0AA0
128 Kbytes               6ES7 953-8LG11-0AA0
512 Kbytes               6ES7 953-8LJ11-0AA0
2 Mbytes                  6ES7 953-8LL11-0AA0
4 Mbytes                  6ES7 953-8LM11-0AA0
8 Mbytes                  6ES7 953-8LP11-0AA0

# EM235 module DIP switches selection

1, switch 6 on/off button to divide the table into two States unipolar/bipolar two full scale input. SW6=ON, select the unipolar; SW6=OFF, select dual polarity.

2, switches 4 and 5 Select gain. SW4 and SW5 3 combinations, namely SW4=ON,SW5=OFF;SW4= OFF,SW5=ON;SW4= OFF,SW5=OFF. A case study of unipolar, when SW4=ON,SW5=OFF, full scale input 0 to 50mV,0 to 100mV when SW4=OFF,SW5=ON; full scale input 0 to 500mV,0 to 1V; if SW4= OFF,SW5=OFF, full scale input 0 to 5V,0 to 20mA,0 to 10V. It is easy to see, SW4= OFF,SW5=OFF corresponding to a current or voltage DIP switch full range input is combined with the first two DIP switches correspond to the current or voltage full scale input into 100 times-times, 10 times. Switch 4 and 5 Select gain *100,*10,*1.

3, select attenuation switches 1,2 and 3. SW3 3 combinations and SW1,SW2, SW1=ON,SW2=OFF,SW3=OFF;SW1= OFF,SW2=ON,SW3=OFF;SW1= OFF,SW2=OFF,SW3=ON, respectively. Users who use the EM235 module knows that unipolar analog signal range is 0-32000, bipolar analog signal range is -32000-+32000, but in fact this value and gain as well as a full range input voltage between attenuation coefficients of conversion. Positive and negative 2.5V to the full range of bipolar input, positive and negative 5V, 10V positive and negative, for example, SW1= OFF,SW2=OFF,SW3=ON corresponding to positive and negative 10V full scale input is combined with the first two DIP switches correspond to the positive and negative 2.5V, plus or minus 4 times, twice times the 5V voltage relationship. So when the attenuation coefficient is 0.2 select DIP switch SW1= OFF,SW2=OFF,SW3=ON; when the attenuation coefficient is 0.4 select DIP switch SW1= OFF,SW2=ON,SW3=OFF; select DIP switch when the attenuation coefficient of 0.8 SW1=ON,SW2=OFF,SW3=OFF

Ov = [(Osh – Osl)*(Iv – Isl)/(Ish – Isl)] + Osl

Of which:
Ov: conversion results
Iv: conversion objects
Osh: conversion result limit
Osl: conversion results lower limit
Ish: conversion limit
Isl: conversion of lower limit

STEP 7-Micro/WIN Programming Tips (Micro/WIN programming skills) Tip38 about how to achieve the conversion routines.
For convenience of users, are now exporting it as custom orders in the Micro/WIN programming software that users can add to their application.

Note: this instruction library/the author and owner of the software‘s functionality and compatibility does not take any responsibility. Risk of using the software by the user themselves. Because it is free, so it does not provide any warranty, error correction and hotline support, users do not have to contact Siemens technical support and services.

In this library, analog input to the subroutine Scale_I_to_R can be used to S7-200 internal data conversion subroutine Scale_R_I can be used for internal data conversion to analog output.

Note: adding custom commands library, you need to close the Edit Library instruction project, established a new project. If you are adding a library instruction, don’t need no different from other sources.

The first step: in the Micro/WIN File (file) menu, select Add/Remove Libraries (Adding/removing instructions) commands or Libraries in the command tree (repertoire) branch, click the right mouse button, select the Add/Remove Libraries
Appears in the Add/Remove dialog box has been integrated in the native Micro/WIN of userdefined instructions.

Second step: Add (add) button, select the newly defined library file path. Userdefined library is automatically added to the Micro/WIN command Libraries under the branches of a tree.
By default, Micro/WIN to find directive file under the path in Figure 8. Users can also specify a different path. But note that libraries should be maintained in a non-removable media, if you specified a removable hard disk, the hard disk is not library not found error occurs when. Users are advised to use the default settings.

# PLC Timer Three basic usage

Basic usage of timers

(1) TC

Description: X0 after 2s, Y0

(2) loss delay fault

Figure 3 power failure delays broken ladder diagram and sequence diagram
Note: when X0 is ON, the normally open contact closure, Y0 connected and self-preservation; when X0 is off, the timer start time delay when X0 when time reaches the time timer setting is removed, Y0 from ON to OFF, realize the loss of delay.
(3) the timer reset circuit

(4) attention to process analysis: X0 connect 1S,T0 ON,Y0State output for the ON,T0 is ON the normally closed contact, T0,Y0 changed its status to OFF. When the X0 is ON, and after a scan cycle, repeat the previous state.

# PLC properties

1. Storage capacity
Storage capacity refers to the user program memory capacity. User program memory capacity, you can develop complex programs. Generally, small PLC user memory capacity for thousands of words, and mainframe user memory capacity of up to tens of thousands of words.

2. I/O points
Input/output (I/O) points is acceptable to the PLC the sum of the input signal and the output signal, an important indicator of performance is a measure of PLC. More I/O points, external input devices and output devices, the more controlling greater scale.

3. Scan speed
Scan speed refers to the speed of PLC user programs, an important indicator of performance is a measure of PLC. General scan 1K the Word user time required by the program to measure speed, usually in units of ms/K. PLC user‘s manual General given the implementation of the directive in time, you can perform the same operation using PLC time, measured and slow scanning speed.

4. Function and number of instruction
Instruction function of intensity, quantity is also important index to measure performance of PLC. Number of programmed instruction more powerful, more PLC and control more powerful, more simple and convenient user programming is, the more complex control tasks.

5. Number and type of internal components
At the time of preparation of the PLC program, requires the use of a large number of internal components to store variables, intermediate results, data, time count, module settings and a variety of flags and other information. The types and quantities of these components more PLC‘s ability to store and handle all kinds of information is.

6. Special function unit
Special types of functional units and functional strength is an important indicator for measuring PLC products. In recent years various PLC manufacturers attach great importance to development of special function unit, special function unit types growing more powerful, PLC control functions has expanded.

7. Scalability
Extended capabilities including I/O point number extension of the PLC, storage capacity extension, networking extension, expansion of the various functional modules, and so on. When choosing a PLC, often need to consider scalability PLC.

# Difference between transistor outputs of the PLC and relay output

Relays are mechanical components have life, transistors are electronic components, only the age, no usage limits. Relay switching times per minute is also limited, and transistors are not. Transistors also have high current, such as 5A above.

1. the load voltage and current type

Type of load: transistor can only bring a DC load, and relays with AC and DC load can be.

Current: current maximum 0.75A relays up to 2 a.

Voltage: transistor can be connected with DC 24V (General maximum is about 30V DC relay can take maximum 30V DC 24V or AC 220V).

Transistor with load capacity is less than the relay load capacity when the transistor is used, sometimes adding other things to drive a large load (such as a relay, solid state relays, etc).

In General, when there is a large impact current situation (such as a light bulb, inductive load, etc), transistor overload capacity is small, requires Derating more.

4. in transistor response times faster than relays

Relay output-type theory is a CPUdriven relay coil, contact absorbs, driven by external power supply by closing the contact external load, the open drain leakage current is zero, slow response time (10ms).

Transistor output-oriented principle is the CPU by coupling the transistor switching to control external DC loads, faster response time (about 0.2ms or even smaller). Transistor outputs are generally used for high speed output, such as servo/stepper, used for high frequency output.

5. rated working cases, relay switching time of life, the transistor aging not only limited to use

Relays are mechanical components have life, transistors are electronic components, only the age, no usage limits. Relay switching times per minute is also limited, and transistors are not. Transistors also have high current, such as 5A above. Is transistor output when followed by a relay, paying special attention to polarity of relay coil (coils in general are connected with a protection diode or led on), or you will burn out transistor.

# PLC no operation (NOP), program end (END) command

1. no operation (NOP)
NOP: no operation

NOP instruction is typically used for the following aspects: Specifies a certain sequence content is empty, blank for use; some short circuit the contacts or circuit, as shown in Figure 7.24 (a), (b) shown cut off some of the circuit, as shown in Figure 7.24 (c), (d) shown in transform previous circuit, as shown in Figure 7.24 (e) as shown.
2. the procedure ends (END) command
END: end of instructions of a program

# Link between touch screen and PLC

You what kind of touch screen and PLC, because each brand of touch screen and PLC connector wiring and communication methods are not the same, you get their wiring diagrams and PLC downloading programs, touchscreen computers configured, when creating a new project, will let you choose what to connect plc, what type, and then select Configure. Last connection plc and touch screen on the phone.

# 485 communication grounded? How should the grounding?

According to long-term engaged in the items technology work of Comrade told: ① RS485 communications short distance (800m within) of General can using no shield of General double twisted line II interference more heavy Shi can using with shield layer of double twisted line (shield layer empty hanging/or only end grounding–to and “strong electric to” especially “frequency device to” separate) ③ signal to General empty hanging (not wiring), if grounding bad instead cannot normal communications.
Most users are also more than the idea. But there are also some one think: connected devices should be common ground; or, if the receiving end has high commonmode input, it is possible to damage the receiver device.
In most cases, when connecting to the RS-485 link you can simply use twisted pair interface a and b respectively together, and talking about signals vacantthis connection method is working on many occasions, but it should be noted that the following two questions:
(1) common mode interference problems: RS-485 interface using differential methods receive input signals, do not need to detect signals relative to a reference point, the system only need to measure the potential difference between the two input lines can. But people tend to ignore the receiver has some commonmode voltage range, commonmode voltage range of -7~+12V RS-485 receivers, only to meet the above conditions, the entire network to work properly. When communication lines common mode voltage is beyond the scope of this communication will be affected is stable and reliable, even corrupted interface.
(2) radiation: drive output commonmode part of the signal requires a return channel, if no return is a low impedance channel (signal), it returned as a radiation source, the entire bus will be like a giant antenna radiates electromagnetic waves.