eBook: Automating Manufacturing Systems; with PLCs

## 15.4 DESIGN CASES

#### 15.4.1 Simple Calculation

Problem: A switch will increment a counter on when engaged. This counter can be reset by a second switch. The value in the counter should be multiplied by 2, and then displayed as a BCD output using (O:0.0/0 - O:0.0/7)

Figure 224 A Simple Calculation Example

#### 15.4.2 For-Next

Problem: Design a for-next loop that is similar to ones found in traditional programming languages. When A is true the ladder logic should be active for 10 scans, and the scan number from 1 to 10 should be stored in n0.

Figure 225 A Simple Comparison Example

As designed the program differs from traditional loops because it will only complete one 'loop' each time the logic is scanned.

#### 15.4.3 Series Calculation

Problem: Create a ladder logic program that will start when input A is turned on and calculate the series below. The value of n will start at 1 and with each scan of the ladder logic n will increase until n=100. While the sequence is being incremented, any change in A will be ignored.

Figure 226 A Series Calculation Example

#### 15.4.4 Flashing Lights

Problem: We are designing a movie theater marquee, and they want the traditional flashing lights. The lights have been connected to the outputs of the PLC from O[0] to O[17] - an INT. When the PLC is turned, every second light should be on. Every half second the lights should reverse. The result will be that in one second two lights side-by-side will be on half a second each.

Figure 227 A Flashing Light Example

Custom Search