PLC Fiddle Compare Challenge

Just about every program usually has some data comparison instruction. This is the ability to compare information from one area of the controller to another and act on results. The output of this comparison conditions the logical continuity of a rung. PLC Fiddle is a free online browser simulator and has the following compare contact instructions.
= (if Equal contact)
<> (if Not Equal contact)
> (if Greater Than contact)
>= (if Greater Than or Equal contact)
< (if Less Than contact)
<= (if Less Than or Equal contact)
We will be looking at these instructions along with some programming challenges. As a system integrator, this ability can prove very useful to you in the field when commissioning your automation system. We will look at these compare instructions and show the parameters required to program them. Our compare challenges will help you gain a good understanding of how we can use compare in the PLC. Trying these challenges with PLC Fiddle is fun and will help you with PLC programming. Let’s get started.
Previously we discussed the free virtual PLC simulator called PLC Fiddle and created some challenges. These challenges are ladder logic that you can solve in your browser.
PLC Fiddle Online Editor and Simulator in your BrowserVideo
Basic Gate Ladder Logic Challenges
AND Gate Ladder Logic Challenge Solution
OR Gate Ladder Logic Challenge Solution
NAND Gate Ladder Logic Challenge Solution
NOR Gate Ladder Logic Challenge Solution
EXOR Gate Ladder Logic Challenge Solution
EXNOR Gate Ladder Logic Challenge Solution
Timer Challenge
On-Delay Timer Challenge Solution
Off-Delay Timer Challenge Solution
Pulse Output Timer Challenge Solution
Counter Challenge
Motor Starter Service Counter Challenge Solution
Count Down Challenge Solution
Hour Minute Second Counter Challenge Solution
PLC Fiddle Math Challenge
Occupancy Count Challenge Solution
Degree F and C Challenge Solution
Determine the Scan Rate of PLC Fiddle Challenge Solution

PLC Fiddle Compare Variables
PLC Fiddle will use variables to perform our compare operations. Variables are on the left side of our browser.

The variables can be any of the following:
Number: This is a constant that we can add to our parameters.

Timer.PRE – Timer Preset Value
Timer.ACC – Timer Accumulated Value (Current Value) Counter.PRE – Counter Preset Value
Counter.ACC – Counter Accumulated Value (Current Value)
Note: See the previous timer and counter challenges for the operation of the accumulated and preset values.
All variables are in BCD in PLC Fiddle. This makes the learning easier.

PLC Fiddle Compare Instructions

Every compare instruction will use two variables. The result of the compare instruction will be Boolean, On/Off. Set the variables before you place the instruction in the work area of PLC Fiddle. You can then select the variables for each of the instructions.
> Greater Than (1st Variable > 2nd Variable)
If the first variable is greater than the second variable the rung condition will be true (On).
< Less Than (1st Variable < 2nd Variable) If the first variable is less than the second variable the rung condition will be true (On).
>= Greater Than or Equal (1st Variable >= 2nd Variable)
If the first variable is greater than or equal to the second variable the rung condition will be true (On).
<= Greater Than or Equal (1st Variable <= 2nd Variable)
If the first variable is less than or equal to the second variable the rung condition will be true (On).
= Equal (1st Variable = 2nd Variable)
If the first variable is equal to the second variable the rung condition will be true (On).
Not Equal (1st Variable <> 2nd Variable)
If the first variable is not equal to the second variable the rung condition will be true (On).

Motor Starter Service Stop Challenge
Previously we did a motor starter service challenge that would turn on an output when the motor starts count was at 1000.
https://www.plcfiddle.com/challenge/18f359d2-75d8-46b5-93bc-96420488c03b
Solution Video:
https://youtu.be/Y_MQ0B3XQu0
Your challenge now is to stop the motor from turning on once the counts are 1200 or more.
https://www.plcfiddle.com/challenge/5e177293-0184-4888-b532-7f0a16ade044
When you are finished the Motor Starter Service Stop Challenge, click the Check button to test the circuit.

Watch on YouTube : PLC Fiddle Motor Starter Service Stop Challenge Solution

Flasher Challenge
Using the compare instruction make a flashing output that will be on for 0.5 seconds and off for 0.5 seconds.
https://www.plcfiddle.com/challenge/bc3e4866-68d4-4544-b2fa-897942e2e26c
When you are finished the Flasher Challenge, click the Check button to test the circuit.

Watch on YouTube : PLC Fiddle Flasher Challenge Solution

Simple Traffic Light Challenge
Create a simple set of traffic lights that are for north/south west/east. There will be a 3 second overlap on the red lights in either direction. The green light will be on for 5 seconds and the yellow light will be on for 2 seconds while the other direction is red. This sequence will then switch.
An automatic resetting timer for 20 seconds has already been set for your timing.
Hint: Create a timing chart for the process.
https://www.plcfiddle.com/challenge/232ad708-e4db-4e0c-bfc7-2353104ba249
When you are finished the Simple Traffic Light Challenge, click the Check button to test the circuit.
Timing Chart for the process:

Watch on YouTube : PLC Fiddle Simple Traffic Light Challenge Solution

Compare instructions are an important part of PLC programming. I hope you found the above compare challenges fun to solve using PLC Fiddle. It demonstrates the basic principles of programming without the investment of equipment. Next time we will look at creating a shift register with PLC Fiddle.

If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.




Leave a Reply

Your email address will not be published. Required fields are marked *