Tag Archives: PLC programming

FX2N series PLC position control module

In machine operation, speed and accuracy are often contradictory, in order to improve machine efficiency and increase speed, parking control there is a problem. So it is necessary to control. As a simple example, motor driven mechanical home by starting location, such as at top speed to return, due to the high speed stop inertia, the deviation in the home has to be large, slow down to ensure the accuracy of positioning.

Position control systems, often adopt servo motor and stepping motor driven device. Openloop control and closedloop control can be used. For stepper motors, we can adjust the send speed to change the machine‘s working speed of the pulse. With the FX series PLC, navigate through the pulse output of the unit or module, you can achieve the position of one or more points. FX2N series are described belowpulse output module and the control module.

(1) pulse output module FX2N-1PG. FX2N-1PG pulse generator unit can complete a separate axis of orientation, this is achieved through servo or stepper motor drive amplifier provides a specified number of pulses to achieve. FX2N-1PG is only used for FX2N series, with TO/FROM instruction set various parameters, and speed read out position value. The modules take up to 8 I/O point. Output up to 100kHz the pulse train.

(2) the controller FX2N-10GM. FX2N-10GM for pulse output unit, whether it is a singleaxis positioning unit, not only can handle single-speed, and interrupts location, and can handle complicated control, multi-speed operation. FX2N-10GM can have up to 8 connections on the FX2N series PLC. Maximum output is 200kHz.

(3) positioning controller FX2N-20GM. A FX2N-20GM controlled twoaxis, performs linear interpolation, circular interpolation or independent twoaxis positioning control. Maximum output pulse trains of up to 200kHz (interpolation period, a maximum of 100kHz).

(4) the programmable cam switch FX2N-1RM-E-SET. In the mechanical drive control, often to diagonal position detection, different at different position in terms of conduction, shutdown signal. Used mechanical cam switches, mechanical cam switches and high precision, but easy to wear. FX2N-1RM-E-SET programmable cam switches can be used to replace mechanical cam switches for high precision angle position detection. Complementary angle sensor cable length of up to 100m. Application and other programmable cam switches, brushless resolver high accuracy angle setting and monitoring its internal EEP-ROM, no batteries, can hold up to 8 different programs. FX2N-1RM-E-SET on the FX2N, can also be used independently. FX2N maximum 3. It takes 8 I/O point.

FX2N Series PLC data communication module

PLC communication module is used to complete with other PLC intelligent control, other communication between devices or computers. Following brief introduction to FX serial communication function expansion board, adapter and communication modules.

(1) communication expansion board FX2N-232-BD. FX2N-232-BD is to connect standard PLC and other RS-232C transport device interface board, such as personal computers, bar code reader, or printer. The panels can be installed inside the FX2N extension. The maximum transmission distance is 15m, the maximum baud rate for 19200bit/s. PLC using special software for the extension plate can be running monitoring, can also be transmitted from the PC to the PLC program.

(2) communication interface module FX2N-2321F. FX2N-2321F on connect FX2N series PLC can realize RS-232C with the other fullduplex serial communications interface devices, such as personal computers, printers, bar-code reading device and so on. FX2N series FX2N-2321F modules can connect up to 8 blocks. The module using FROM/TO command to send and receive data. Maximum transmission distance is 15m, the maximum baud rate for 19200bit/s. The modules take up to 8 I/O point. Data length and serial communication baud rate can be set by a special data register.

(3) communication expansion board FX2N-485-BD. FX2N-485-BD for RS-485 communication. It can be applied to no agreement on data transfer, FX2N-485-BD at the time of the original agreement, as a way, using RS instruction in personal computers, barcode reader, printer, data transfer between. Transmitting maximum transmission distance is 50m, the maximum baud rate for 19200bit/s. Each of the FX2N series PLC expansion boards can be fitted with a FX2N-485-BD communication. In addition to using this communication expansion boards and computer communications, it can also be used to achieve two parallel between FX2N series PLC.

(4) communication expansion board FX2N-422-BD. FX2N-422-BD to RS-422 communications, can be connected on the FX2N series PLC, and as a tool for programming or control a port. This interface is available outside of the PLC connected to PLC devices, data storage unit, and human-machine interface. FX2N-422-BD can be used to connect two data storage unit (DU) or DUseries unit and a programming tool, but one can only connect a programming tool. Every basic unit can be connected to a FX2N-422-BD and cannot be used with FX2N-485-BD or FX2N-232-BD.

(5) the interface module MSLSECNET/MINI

Use MSLSECNET/MINI interface module, series PLC of FX series PLC can be used as a local control station, constitute a distributed control system.

Above on the FXseries only gives a brief introduction to the communication module, specific application again in detail in later chapters.

Siemens S7-200 PLC programming examples – Belt conveyor control

To look many PLC Ladder Diagram is better for learn plc programming. you can learn the plc programming Thoughts and ideas. here is siemens s7200 plc rpgramming examples.
(1) control requirements
Motors M1, M2, M3 three drive belt conveyor.Press the start button SB1, start the order of M1, M2, M3, the interval of 3s.Press the stop button SB2, the order of the parking for M3, M2, M1, the interval of time is 3s. Three motors M1, M2, M3 respectively through the contactor KM1, KM2, KM3 connected three-phase AC power supply, with PLC control of the coil of the contactor.

(2)Address allocation table for programming elements
 Programming element
I/O terminals
(program address)
Circuit devices
(PT timer value)
 input relay
start button
Stop button
 output relay
M1 Contactor
M2 Contactor
M3 Contactor
Start first period of time
Start second period of time
Parking first period of time
Parking second period of time
Auxiliary relay
Parking holding first
period of time
Parking holding second period

(3)Ladder Diagram

PLC ladder programming

Siemens S7-300 Ladder Diagram PLC Programming Example-Control Belt

This PLC programming example is plc control belt

(1) Control requirements

Electric start belt,At the beginning of the belt has two push button switches: S1 for START and S2 for STOP;At the end of the belt also has two buttons switches: the S3 for START and STOP for the S4. You can start or stop the belt from either end. In addition, when an object on the belt reaches the end, the sensor S5 make  belt stop.

(2)Programming element symbolic address

Symbol Address
Absolute address
class type
Start button
Stop start button
Tail start button
Tail stop button

(3)Ladder diagram

PLC programming ladder diagram

Siemens PLC S7-300 Ladder Diagram Programming Example-pulse generator

Siemens plc S7-300 programming the timer can also be   a pulse generator.

(1) Control Requirements

The PLC program using a timer constitute a pulse generator,With two timers generate a pulse signal frequency of the duty cycle can be set

Timing diagram of the pulse generator

(2) Ladder Diagram

PLC Ladder Diagram

When the input I0.0 is 1, the output Q0.0 is 0 or 1 alternately, a periodic pulse signal for 3s, the pulse width is 1s.

STEP 7 hardware configuration tool HW Config

Select the SIMATIC manager on the left side of the station, double-click the right window of the “hardware” icon, open the hardware configuration tool HW Config

(1) hardware directory

You can use the menu command to “view”, “directory” or the button on the toolbar to open or close the hardware directory window on the right. Select a hardware directory in a hardware object, the hardware directory below the small window to see its brief information, such as the main function of the order number and module, etc..
CP hardware directory is a communication processor, FM is a function module, IM is the interface module, PS is the power module, RACK is the rack or guide rail. SM is a signal module, in which the DO, AI respectively is the digital quantity input module and the digital quantity output module, AO, DI respectively is the analog quantity input module and the analog quantity output module.

(2) hardware configuration window

Figure 2-20 the upper left window is the hardware configuration window, the window is placed in the host frame and the expansion of the rack, and use the interface module to connect them. PROFIBUS-DP network can also be generated in the window, and placed DP from the station on the network.

(3) hardware information display window

Select the hardware configuration window in a rack or DP slave station, the following hardware information display window will display the detailed information of the selected object, such as module order numbers, CPU firmware version number and in the MPI Network station address, and I / O module address and annotations. The upper left corner of the window button is used to switch the rack or DP slave station in the hardware configuration window.

how to get a signal PLC ladder program

PLC programming often need to use different commands to obtain different information on the switch
this is plc programming examples

1. Get information on the rising edge

To obtain information on the rising edge of the input signal by the transition instruction, contacts and trigger rising edge pulse

2. Get information falling edge

To obtain information on falling edge the input signal drops by contact and falling edge pulse trigger

3. Get level information

     If the button corresponding to the input port is normally open, the program can be obtained through a high level of information normally open contact, normally closed contact information to obtain Low level

PLC ladder diagram input signal conditioning program

whatever  the input signal X20 High level  havs Any time,
They are generating a pulse signal  width,

It can be the input signal sorting program, which was to became unified pulse signal,you can see the PLC ladder diagram programming

PLC programming in Ladder Self-maintaining bit (self-locking) instruction

When any one of IR00004 and IR00005 is “ON”, HR0000 will be set to “OFF”.


PLC ladder programming Instruction control bits

        ① set and reset. When the condition becomes ON”, the set will be put in operation ON”, but not as output (OUT), when the condition becomes OFF”, the reset will not reset on the operation of OFF”. When the condition becomes ON”, the reduction in operation position reset OFF”, but does not output non-directive (OUT NOT), when the condition becomes OFF”, the reset will not reset on the operation ON”. In the following example, no matter how IR00100, IR00100 reset ON” IR20000 will reset when ON”, and can remain ON” until the IR00101 reset ON”. When IR00101 set ON”, the reset IR20000 reset OFF”. Set and

No function code set and reset. From the handheld programmer to enter them as FUN and SET key or FUN and RSET button, followed by the address.

       ② rise differential differential and the falling edge. Rise differential and the falling edge of the so-called differential refers to the input signal front porch and back operations. Rise differential differential command is used to enable and falling in a cycle time of the built-in ON”. In implementing the conditions OFF” to ON”, the rising differential instruction makes a cycle of operation ON”, in the implementation of conditions ON” to OFF”, the falling differential instruction makes a cycle of operation ON”. Both of these instructions requires only one line mnemonics.

Here, in IR00000 to ON”, IR20001 in a cycle will reset ON”. Then perform DIFU (13) 20001, no matter how IR00000, IR20001 will be OFF”. Falling edge differential instruction IR00001 to OFF” after (IR20002 OFF” until this time), the IR20002 will be built in a cycle ON”, and will be implemented in the next DIFD (14) 20002 post OFF”.
Rise differential and the falling edge of differential

       ③ maintain. Use directives to keep based on two perform conditional operations. Doing so will keep the instructions attached to two on the command line. When the first command line execution at the end of the condition for ON”, keep instructions operating position ON”. When the end of the second command line execution as ON”, keep instructions operating position OFF”. Even if it is located in the internal interlocking parts of the program, keeping the operation of the directive will save it to the ON” or OFF” State.
In the example shown in Figure 1-33, when IR00002 is ON” and IR00003 to OFF”, the HR0000 will be set ON”. HR0000 remain ON” until another IR00004 or IR00005 reset ON”. Keep instructions as the others, need more than one command line, the command line in the instruction encoding before they control.