Tag Archives: plc programming examples

How does Mitsubishi PLC control the size of the ladder diagram?

Here is mitsubishi plc programming examples

After zooming in on the view, it cannot be displayed in full screen.

Can not control the size of the ladder, can only change the size of the annotation and the number of contacts displayed in each row;
The number of contacts in the menu bar – “Tools -” option, pop-up dialog box point program editor – “ladder -” ladder diagram,
Select the number of display contacts in the display format,
It is recommended to choose 13 or 11.

plc programming examples

more can from here https://sites.google.com/site/lolletteshop/

FX2N series PLC analog I/O modules

(1) analog input module FX2N-2AD. The module is a 2channel voltage input (DC 0~10V,DC 0~5V) or current input (DC 4~20mA), 12-bit high accuracy resolution conversion speed for the 2.5ms/channel. This module occupies 8 I/O point applies FX1N and FX2N, FX2NC series.

(2) analog input module FX2N-4AD. The module has 4 input channel, 12-bit resolution. Select a current or voltage input, choose user wiring is to be achieved. Optional analog value from DC ± 10V (resolution of 5mV) or 4~20mA, and -20~20mA (resolution of 20 μA). Convert at a speed of up to 6ms/channel. FX2N-4AD using 8 I/O point.

(3) analog output module FX2NP2DA. This module is used to convert the 12-bit digital 2 analog outputs. Output can be in the form of voltage or current. Their choice depends on the wiring. Voltage output, two analog output channels of the output signal is a DC 0~10V,DC 0~5V current output for the DC 4~20mA, resolution of 2.5mV (DC 0~10V) and 4 μA (4~20mA). Digital to analog conversion characteristics can be adjusted, conversion speed for the 4ms/channel. This module requires 8 I/O points for FX1N and FX2N, FX2N series.

(4) analog output module FX2N-4DA~ which has 4 output channels, providing precision 12-bit high resolution digital inputs. Conversion speed is 2. 1ms/channel, the channel number will not change conversion speed. Other properties of the module is similar to FX2N-2DA.

(5) analog input module FX2N-4AD-PT. This module matches the PT100 temperature sensor, will come from the 4 foil temperature sensors (PT100,3 line, 100 ω) input signal amplification, and convert it into 12readable data that is stored in the main unit. Celsius and Fahrenheit data can be read. Internal temperature transducers and analog input circuit, can rectify the sensor‘s nonlinear. Read a resolution of 0.2~0.3 degrees Celsius. Conversion speed: 15 Ms/channel. All the data and parameter settings can be done through the FX2N-4AD-PT software configuration, realized by FX2N TO/FROM application instructions. FX2N-4AD-PT using 8 I/O points can be used for FX1N and FX2N, FX2NC subsystem.

(6) analog input module FX2N-4AD-TC. The module match the thermocouple type temperature sensor, from 4 thermocouple sensor input signal is amplified and converted to 12-bit data can be read, stored in the main unit. Celsius and Fahrenheit data can be read. Reading of the resolution type k is 0.2 deg c; type j for 0.3 c, can be used with k(100~1200℃) and j (100~600℃) supporting the use of thermocouples, 4 channel using k/j type, conversion speed for the 240ms/channel. All the data and parameter settings can be done through the FX2N-4AD-TC software configuration. This module takes up 8 I/O point.

Omron PLC high-speed counter reset method

Omron PLC high-speed counting the number of reset mode, choose Z signal + software reset and soft reset in two ways.
       1. Z signal + software reset mode

       High-speed counter reset flag is ON state, Z-phase signal and reset input OFF → ON time by the high-speed counter current value is reset. The case of addition, since the reset flag is ON, 1 cycle 1, can be determined only in the common process, and therefore occur in the ladder program OFF → ON from the beginning of the next cycle Z-phase signal is active again.

       2. Soft reset mode

       When high-speed counter reset flag from OFF to ON, the high-speed counter current value is reset. In addition, the reset flag OFF to ON determination 1 cycle 1, carried out in the common process, the reset process is also the time. However, in the middle of a cycle period when ON to OFF change, reset flag is Dhamma track.

How do wire OMRON proximity switch and the PLc?

DC two-wire type: Brown line PLC input point com PLC received positive power supply, power negative to the blue line.

NPN type: Brown plugged blue Power, black line received a PLC input points, com is connected to a power supply of the PLC. Type NPN is leaking, when an object is detected low level signal output.

PNP type: Brown plugged blue Power, black line received a PLC input points, com PLC received Power. PNP is the source type, object output high when signal is detected.

Omron PLC programming software to use the function block

Omron PLC programming software also increases the function block function block preparation software features to IEC61131-3
A function block call a ladder example
The main purpose is to promote good function block structured programming, function calls; allow complex programs to create less code, more manageable process.
A block from the block header and block body composition
Physique – to be used in the function block program data: as a variable input and output connections, the function block variables, parameters are defined locally within a block – parameters.
Blocks may contain instructions algorithm – this is the actual code for each function block execution. Call, the corresponding input and output variables corresponding to the actual variable substitution. Not all PLC function blocks can be created.
The function block can be established Omron PLC: CJ1M, CJ, CS, CP1H / L, etc;
The number of each type of PLC function blocks that can be created is different. You can define up to 64 function blocks in the PLC, up to 30,000 write statements.
Steps for creating and using function blocks
A, PLC must be a valid PLC type.
Second, the definition of the function block is created. Select the appropriate function block type: ladder or structured text; the new block is created, its name will default to ‘block’.
Third, it is to open the block for editing, including setting a variable using function blocks in the block header; block the use of written algorithms function block ladder structured editor or a text editor to write.
Fourth, created after the function block can be called in the main program using the ladder diagram editor.
If a specific function block already exists, from ‘FB list’ option. If not, the function block is created only need to enter a new name, select the appropriate ‘FB list’ definition. The function block is created automatically in the global symbol table selection (including the allocation of memory for each variable in the function block header is defined); calling function block will be displayed in the ladder.Executive function block calls can be connected to the function block EN input pin through execution conditions. When the execution condition is satisfied (equivalent to True), energy flow reaches the EN pin, the function block is executed. Function Block ENO output pin optional. It is optional; you can connect to perform coil or execution conditions, but the right-most elements must be terminated with a coil or instructions.
V. The function block input and output pins.
These pins must use the [ENTER] key or from [insert] [function block parameters] menu option to select the parameters of the connection; rather than using the contact or coil connection. Left function block input pin; the right side of the function block output pin. Input and output pins connected to the function block is entirely optional.
Sixth, after the setup is complete, CX -P program can compile, download and run.
Establish ways
Select the tree menu [block], right insertOr select the tree menu [block], and then from the drop-down menu [Insert], select the [block]
There are several forms to create
First, the direct import (suffix .CXF) existing function blocks from the file;Second, create your own: structural way to write text; or a ladder to write.
Select the appropriate cell programming area, right call, or use the [Insert] menu [function block call] option.

Frequency measurement for Omron PLC high-speed counter

By PRV instruction, you can read the frequency of the input pulse, high-speed counter frequency measurement, frequency is measured in Hz, hexadecimal 8-bit output, and can be used only in high-speed counter 0. In addition, also during high-speed counter 0 comparison operation at the same time, measurement frequency. Even in the frequency measurement, nor will feature high-speed counter, pulse output function has been affected.

      1. High-speed counter frequency measurement step

(1) the use of high-speed counter settings without using the /: the PLC Setup High-speed counter [O / without] is set to “use.”

      (2) counter selection: Setting PLC Setup High-speed counter in the [] / [] pulse input mode.

      Sampling (3) Value range mode: select System Settings in the PLC high-speed counter [O] / [] mode range of values, the value range mode to ring mode, the selection PLC Setup High-speed counter 0 [ ] / [] ring counter maximum value.

      (4) Select the reset method of high-speed counter current value: Select PLC Setup High-speed counter [0] / [Reset] mode.

      Execution (5) PRV instruction: Operands N is the number of high-speed counter [high-speed counter input 0: # OO1O]; C is the frequency of the operand read is # 0003; operand D is a frequency to save channel.

Omron PLC equipment disassembly sequence and method

(1) downtime must be two or more people care operations;
(2) The front panel of the CPU mode selector switch from “Run” to “stop” position;

(3) off the main power supply of the PLC, and then close the other to die Sakamoto power supply;

(4) The power supply shelf connected to the power line wire number and remember clearly after connecting position, and then remove the screws power racks and cabinets connected to the power rack can be removed;

(5) CPU board and I / 0 board may, upon rotating the screw template underneath removed;

(6) When installing in reverse order.

Initialization module (OB100) – Siemens S7-300PLC organization block OB

When the CPU state into the stop state operating mode, the operating system calls OB100. After the end of OB100 operation, operating system calls OB1.
Use OB100 characteristics prior to execution of OB1, you can prepare the initial variables or parameters for the user to run the main program.

Hardware interrupt (OB40) – Siemens S7-300PLC organization block OB

Response process from different modules (eg I / O modules, CP or FM module module) issued a warning or a hardware interrupt request signal.

OB 40 runs, the operating system does not receive the other hardware interrupt requests.
You can modify the parameters for analog or digital module with a programming tool which is set by the start signal OB 40. For CP and FM, the software must also provide supporting module settings. By calling SFC, also set online is interrupted by a hardware module in the program is running.

OB40 Application

When the system is configured analog input module, the user can set the allowable range of measured values, if the measured value exceeds this limit, OB40 is called. This feature is similar to the OB1 the comparison logic, but it is omitted in OB1 control program, saving the scan cycle time.

Cyclic interrupt (OB 35) – Siemens S7-300PLC organization block OB

Set or modify the interval (default is 100ms) from the programming tool. Ranging from lms ~ lmin.
When allowed to interrupt the cycle, OB35 cycle run at regular intervals.

When OB1 OB35 run to set time, OB 35 is executed again.

When using OB 35 properties, should ensure that the value of the interval is set longer than the running time of OB 35 in the program, or cause abnormal system, the operating system calls an asynchronous error OB 80.

Delay interrupt OB 20- Siemens S7-300 PLC organization block OB

By calling the SFC 32 starts. SFC 32 o’clock to provide arguments is called.
OB-NR delay interrupt OB numbers
DTIME delay length (1 to 60000ms)
SIGN extended into OB OB called startup information signs
RET-VAL OB the error code if an error occurs during the execution of
Delay interrupts SFC
SFC32 SRT_TINT start delay interrupts
SFC33 CAN_DINT cancel delay interrupts
SFC34 QRY_TINT query delay interrupts

Day interrupt (OB10) – Siemens S7-300 PLC organization block OB

OB10 can be run according to the following intervals:
Once (once): only once at a specific date and time.
Every minute: starting from a specific date and time, once per minute.
Hourly: starting from a specific date and time, once per hour.
Daily: starting from a specific date and time, once a day.
Weekly: starting from a specific date and time, once a week.
Monthly: starting from a specific date and time, once a month.
Annually: starting from a specific date and time, once a year.
OB10 the start time and interval settings:
1. define OB10 execution start time (date and/or time) and OB10 interval configured.
2. through S7 configuration tool to configure CPU clock interrupt parameter or in a program called SFC28 (SET-TINT) setting time.
3. the S7 configuration tool in the CPU‘s clock interrupt block, select activate,
4. in the program calls SFC30 (ACT-TINT) to activate the OB10.

Siemens PLC cycle right and left shift instruction

Rotate the end to end the shift data storage unit, while connected to the overflow flag SM1.1, SM1.1 is used to store the bit shifted out.

(1) cyclic left shift instruction (ROL)
Enable input is active, the number of non-IN input (byte, word, or double word) Rotate Left N-bit symbols, the result is output to the memory location specified by OUT, the last bit of value out of the overflow flag to send bit SM1.1. When you need to shift value is zero, the zero flag SM1.0 to 1.
(2) cyclic right shift instruction (ROR)
Enable input is active, the number of non-IN input (byte, word, or double word) Rotate Right after the N-bit symbols, and outputs the result to the memory location specified by OUT, the last bit of value out of the overflow flag to send bit SM1.1. When you need to shift value is zero, the zero flag SM1.0 to 1.
(3) The shift number of shifts N≥ data types (B, W, D) when handling
If the operand is a byte, when the shift count when N≥8, then before performing cyclic shift, prior to N modulo 8 operation (N divided by 8 after taking the remainder), the result 0-7 for the actual movement of the bit number.
If the operand is a word, when the shift count N≥16, then before executing the cyclic shift, prior to N modulo 16 operation (after N take the remainder divided by 16), the result is actually moving bits 0-15 .
If the operand is a double word, when the shift count N≥32, then before executing the cyclic shift, the first of 32 operations modulo N (N is divided by 32 after taking the remainder), the result is actually moving bits 0-31 number.
(4) Error conditions that set ENO = 0: The 0006 (indirect addressing error), SM4.3 (run-time).


 Loop left and right shift instruction form and function
Operands and data types
IN: VB, IB, QB, MB, SB, SMB, LB, AC, constant.

Data type: BYTE
IN: VW, IW, QW, MW, SW, SMW, LW, T, C, AIW, AC, constant.
Data Type: Word
IN: VD, ID, QD, MD, SD, SMD, LD, AC, HC, constant.
Data Type: Double Word
N: VB, IB, QB, MB, SB, SMB, LB, AC, constant; data type: Byte.
ROL: Byte, Word, Rotate Left Double Word N bits; ROR: byte, word, double word Rotate Right N bits.

Normally closed contact Input signal Processing circuit and PLC ladder diagram

In these input signals can only be provided by a normally closed contact, Figure 1a is to control the motor run relay circuit, SB1 and SB2 start button and stop button, respectively, if they are normally open contacts connected to PLC input, type contacts in the ladder diagram with exactly the same figure 1a. If access PLC of is SB2 of often closed touch points, by Xia Figure 1B in the of SB2, its often closed touch points disconnect, X1 into OFF, it of often open touch points disconnect, apparently in trapezoidal figure in the should will X1 of often open touch points and Y0 of coil series (see figure 1c), but then in trapezoidal figure in the by with of X1 of touch points type and PLC add-ins SB2 of often open touch points Shi just instead, and following electrical circuit diagram in the of habits is instead of. Proposed as normally open for PLC input signal.

     If some signals can only be normally closed contact input, you can enter all designed for normally open to, and then in the ladder diagram knowledge input contacts of the relay contacts to the opposite, that is normally open to normally closed contact, normally closed contact normally open contacts instead.

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 differential circuit

Rise differential differential circuit and the falling edge of differential pulse circuit, discussed below.

Rose along differential pulse circuit, PLC is to cycle scan way work of, in PLC first times scan Shi, entered X0 by OFF into ON Shi, M100, and M101 coil connected, but in first line of M101 of often open touch points still connected, because the line has scan had has, until PLC second times scan Shi, M101 of touch points only disconnect, Y0 coil disconnect. Y0 is the ontime for a scan cycle, as shown in Figure 8.

Next introduce the falling edge of differential pulse circuit, as shown in Figure 9, when X0 from ON to OFF is connected a scan cycle M100, Y0 is a scanning pulse output, specific works, please themselves.

Using PLC to realize any of the input signal frequency

Using PLC to realize any of the input signal frequency

Frequency pulse signal applied on the X0 side, in the first pulse arrives, a scanning cycle pulse M100, M100 normally open camp, closed a scanning cycle. Determine the condition that Y0 Y0 State set to 0, M100 set to 1.
Y0 in the conditions of work in two branches, 1th slip roads connecting, disconnect 2nd branch, Y0 reset 1.

First pulse comes after a scan cycle, M100 for 0, Y0 reset 1, Y0 in such conditions, the second slip road keep Y0 reset 1.

When the second pulse arrives, a single scan cycle pulse M100, Y0 reset 1, M100 is set to 1, this makes Y0 changed its status from 1 both set to 0.

Second pulse comes after a scan cycle, 0 and M100 Y0 reset set to 0 until the third when it comes to scanning Y0 and M100 and exactly the same when it comes to first pulse, Y0 will repeat the procedure discussed in front of state changes.

Through the above analysis, the X0 sent two pulses, Y0 produces a pulse, complete the input signal frequency

PLC programming elements timer

Timer is equivalent to relay time relay in the circuit may delay control in your program. FX2 series programmable controller has the following four types of timer.
100ms timer: T0~T199 200 timing ranges: 0.1~3276.7 s
T200~T245 46 10ms timer timing range: 0.01~327.67 s
1ms totalizer timers T246~T249 4 (interrupt) time range 0.001~32.767 s
100ms totalizer timer T250~T255 6 timer range 0.1~3276.7s
Timer programmable controller based on cumulative timing clock pulse, clock pulse 1ms, 10ms, 100ms in different specifications. (Process timer job is actually the clock pulse counts) because of work, outside of own numbered memory, timer, also played a set value registers (Word), a current values of registers (Word). Setting register (Word) store when programming timings set value of an assignment. Current values of registers recording timer to the current value. These registers as a 16-bit binary storage. The maximum value multiplied by the time timer value is the maximum timed range of timer values. The timer starts timing conditions are met, current values of registers is counted when the timer actions when the current value is equal to the set value, normally open contacts connected normally closed contacts disconnect, and procedures used to control the object, achieve the purpose of time control.
Figure 6 timer used in the ladder diagram. Figure 6 (a) as a normal non-totalizing timer. Figure 6 (b) integrating the timer. Figure 6 (a) in the X1 time condition, when X1 is switched on t-10 times of the timer begins. K20 as the set value. Decimal number 20 for the timer time unit values of multiples. T 10 to 100ms timer, when set value is K20, its time time of 2s. Y10 for timer objects in the picture. When time is up, timer t 10 normally open connecting, Y10 set to 1. T10 is the non-accumulation-type timer. At the beginning of its time and not when the set value is reached, disconnect timing conditions X1 or PLC power power failure, time to abort and the current values of registers reset (set to 0). Disconnect if X1 or PLC power power failure occurs in the timing process is complete and the contact of the timer action, contact action cannot be maintained.
T 10 timer replace timer T250 product formula, the situation is different. Plot formula of timer in timed conditions or PLC lost lose the power, the current values of registers contents and contact status can be maintained, cumulative timings. So called accumulation. Figure 6 (b) ladder diagram for timer t 250 product formula work. Timer product formula current values of registers and contact with memory function, you must join in a program dedicated to reset reset instructions. X2 is a reset condition. When X2 connected to perform RST T250 instruction, t 250 the current values of registers and contacts at the same time set to 0.

Figure 6 timer using
Timer you can use the number k as the set value at once, such as in Figure 3-5 K20 and K345, also can be used after the data content of the register as a set value. Set timer value is D10 and D10 content is 100, the timer value is 100. When using the data set timer value registers. General use has the power to keep the data register. Even so, if battery voltage decreases, the timer may malfunction.

Mitsubishi FX2N PLC instructions- four-storey elevator control system

1~4 the stairs outside the request button, FU, FD;
1~4 floor SQ1~SQ4 floor signals;
In the boot button on the control panel signals;
Elevator door opening and closing limit switch.
Output signal:
Lifting light,
Elevator lift AC contactor KM1~KM2,
Elevator door AC contactor KM3~KM4,
The Bell.
1. upon the request 1-4 outside staircase and elevator operation status timely response:
Increase process, floor upstairs along the request, stop and open the door, otherwise no action;
Descent, floors downstairs along the request, stop and open the door, if not action.
2. Upon request of the compartments on the Control Panel, lift passengers to the appropriate layer.
3. Elevator travel time less than 10S, otherwise stop the ladder and alarms, notify maintenance personnel to economically disadvantaged.
4. Lifts open and close time of less than 3S.
5. Ladder on the door waiting for passengers, 5S closes automatically after.
6. If passengers open 5S press close button, the elevator door.
7. Request button to reset.