how to use counters to add and subtract

ladder diagram on how to use counters to add and subtract

  • explain how to use counters to add and subtract

    Votes: 2 50.0%
  • explain how to use counters to add and subtract

    Votes: 2 50.0%

  • Total voters
    4
Join Date
Nov 2016
Location
cape town
Posts
1
Good day all! Im still very new to plc. I just started and having trouble understanding counters. I dont know how to use the counter to add and substract. I have this exersice i must do about people entering a mall with 3 doors and exiting the mall. And at the end if the mall is empty then a green light must go on. Laser sensors at each door. I just know you' ll be able to help me. Thanx in advance!
 
Sounds like an assignment....Adding and subtracting are not the terms used for counters, you should refer to them as Counter UP or Counter DOWN.

Think how can you count people entering and exiting.. Think about how many counters you need... Once you have that, you are pretty much done.

Put a rough logic out there and I would be able to help you more.
 
A lot will depend on the PLC you're using. If the function set includes an Up/Down counter, you can make the counter's accumulated value increase when the sensor detects someone entering and make the value decrease when the sensor detects someone exiting.
Or you could use two counters, one for entering, the other for exiting. The difference between the accumulated values represents the number of people inside.
The real trick is to come up with sensors and a traffic control system to unambiguously detect people entering and exiting.
 
...
The real trick is to come up with sensors and a traffic control system to unambiguously detect people entering and exiting.

That is invariably the hardest part... there are so many things that can go "wrong" especially with people, on their own, on crutches, in wheelchairs, on mobility scooters, with or without children in tow, with pushchairs, dragging suitcases, to name a few "problem" areas.

This assignment is most often presented as a Car Park application, where cars are counted entering and leaving, and a FULL sign is illuminated (and entry barrier inhibited) when there are no spaces left. A very similar task, I'm sure all would agree, and a great deal simpler to do the "detection" part.....

Thankfully, this is an assignment, I would hate to have to work on this. Actually I can't see why you would want to know if the mall is "empty".... you surely wouldn't be locking doors and setting intruder alarms based on a door-count !!!

Design considerations for counting then (leaving aside the problems in detecting)....

Simple approach - use 1 counter.... make a counter "count UP" when someone enters by any of the 3 doors, similarly "count DOWN" when someone leaves by any of the 3 doors. This could work, but problems might exist if there were multiple and simultaneous "triggers" from the door sensors, extra logic in the form of "sensor memory bits" could be used to overcome this, but it gets messy.

Less simple, but more robust - use a separate counter for each door. The number of people in the mall would be the sum of the counter accumulator values. This could have a problem if people habitually and consistently enter via one door, and leave via another.... one counter would spiral upwards, and another spiral downwards, and if left unchecked, eventually the counters would over, or under-flow. I said "if left unchecked", there is a very simple way to prevent this from occurring....

More complicated, but as robust as you are going to get, is to forget "counters" altogether, but since wilma needs to learn about counters, as opposed to "counting", I'll stop there.
 
[FONT=&quot]Do you need to use inbuilt counters? Personally I always prefer just adding and subtracting from a normal register. [/FONT]
 
You can also get familiar with using a memory word that's assigned as an integer value. Sometimes I find this method a little easier then using a counter instruction.
 
[FONT=&quot]Do you need to use inbuilt counters? Personally I always prefer just adding and subtracting from a normal register. [/FONT]

You can also get familiar with using a memory word that's assigned as an integer value. Sometimes I find this method a little easier then using a counter instruction.

The OP wrote.....

"Good day all! Im still very new to plc. I just started and having trouble understanding counters. I dont know how to use the counter to add and substract. I have this exersice i must do about people entering a mall with 3 doors and exiting the mall."

It sounds to me like the exercise is about gaining an understanding of counters, they've probably already covered the ADD and SUBtract instructions....
 
Last edited:

Similar Topics

Hi Hope you all are doing well. Iam working on a project with some AOI. I also hate no online edits... lol. My problem occurs when I use a UDT...
Replies
2
Views
156
Hey guys, thanks for reading. I am trying to use a micrologix(1000 or1500) to control 3 hydraulic pumps. I have a time clock to give a signal to...
Replies
38
Views
3,449
iFIX 5.5. We have alarm count database tags with SIM driver and I/O address = "C:AREA-SD:ACK" which is suppose to count the acknowledged alarms in...
Replies
16
Views
1,392
https://www.youtube.com/watch?v=zTOOYWMJg9M . Specifically see 1:46 to 2:11. 3. The Cell PLC is in constant communication with two other field...
Replies
14
Views
3,101
Does the 1100 only have 1 high speed counter, but it can have multiple inputs? And so then the 1400 has 6 HSC and you have a choice of multiple...
Replies
1
Views
1,713
Back
Top Bottom