From the course: Learning PLC Ladder Logic: 2 Diving Deeper

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution 2: Use arithmetic instructions

Solution 2: Use arithmetic instructions - Ladder Logic Tutorial

From the course: Learning PLC Ladder Logic: 2 Diving Deeper

Start my 1-month free trial

Solution 2: Use arithmetic instructions

- [Instructor] Now for the next step in order to show the time remaining, I'll explain what I'm going to do using this simple visualization. Think about it this way: if I ask you to count from one to 10, 10 being the preset value here, you would start counting from one, two, three until you reach 10, right? Now, if I want you to count backwards, 10, nine, eight and so on, notice here that going backwards is simply subtracting 10 minus the number I was counting up to. So 10 minus one equals nine. 10 minus two equals eight and so on. So I can use the 10 which is my preset value minus the accumulated value in order to show the remaining time. Simply the time remaining equals timer preset minus timer accumulator. For that, we are going to use a subtraction instruction in the run subtracting the preset minus the accumulated value and saving the results in address N7 bit one. And then finally, to send the values to…

Contents