# Basic PLC Ladder Programming Examples 20

Basic PLC Ladder Programming Training Examples for Beginners.

### Hi friends, here we are starting unique a series of Free Training on PLC Ladder Programming & tutorials. These PLC Ladder Programs are important to learn basics of Ladder programs.

Summation of Continuous D Registers
·
Summing up the values of D registers from D101 to DN (the number of N is determined by users) and storing the operation result in D100. If the result < K-32768, the borrow flag = ON; if the result > K32767, the carry flag = ON

Topics Covered in this example is FOR NEXT PLC instructions of Ladder Program.
Number of PLC Outputs Required
Y0 Borrow flag indicator. When the value in D100 < K-32768, Y0 = ON Y1 Carry flag indicator.
When the value in D100 > K32767, Y1 = ON
Number of PLC Data Registers Required
D100 Storing the sum of all D registers
D500 Storing the executing times of FOR-NEXT loop

·      The key of the program is to use the index register E1 together with FOR ~ NEXT loop to vary
the addend D100E1. When E1 = K1, D100E1 represents D101; when E1 = K2, D100E1
represents D102. Also, when E1 = K10, D100E1 represents D110.
·      The number of continuous D registers is determined by the execution times of FOR ~NEXT loop which is set by D500. If the value in D500 ≤ 1, the loop will execute 1 time.
If the value in D500 = K10, the loop will execute 10 times first and then
execute the instructions behind 4. Index Registers E, F Design Examples 4-2
DVP-PLC Application Examples the loop.
·     In the first FOR ~ NEXT loop, E1 = K1, so D100E1 represents D101. ADD instruction is executed, and the operation result of D100 plus D101 is stored in D100. Since the summand
D100 = K0, the value stored in D100 equals to the value in D101. At the same time, INC instruction is executed to set E1 = K2.
·      In the second FOR ~ NEXT loop, E1 = K2, so D100E1 represents D102. ADD instruction is
executed, and the operation result of the values of D100 plus D102 is stored in
D100. Since the summand D100 = D101, the value stored in D100 is the sum of the
D101 and D102.
·      According to the same process, by the 10th FOR ~ NEXT loop the value in D100 will be the sum of D101, D102, D103, D104, D105, D106, D107, D108, D109 and D110.
·      If the operation result < K-32768, M1021 will be ON to activate the output coil Y0. Borrow
flag indicator will be ON. On the contrary, if the operation result > K32767, M1022 will be ON to activate output coil Y1. Carry flag indicator will be ON in this case.

Note: Example is only for training purposes. No practical implementation is done. See More PLC Ladder Programming Examples