- Slides: 17
Introduction We use timers to measure the elapsed time between two events. With retentive timers the “run” signal can be turned on and off again until the preset time is reached. Counters don’t care how long the activation signal is on, but rather each off to on transition. This is also called “positive edge” or “rising edge” triggered.
Types • Up counter • Down counter If your going to count five events, it doesn’t matter if you count up to five from zero or down to zero from five.
Counter - internal structure
High speed counter • Can count events up to 8 k. Hz, like shaft encoders • NOT available for us. Only on the Micrologix PLCs
Response time If we assume that a PLC had a 10 m. Sec scan time, the period = 1 / time or 100 Hz. That means to detect a low to high transition would require the PLC to see the input low on one scan then high on the next. The counter then could count no faster than once every two scans. At 10 m. Sec a scan, 20 m. Sec or 50 Hz is the fastest that we could expect the counter to respond.
Devices Most times the PLC counter is required to count the number of times a limit switch, or photoeye has activated. These events are slow enough for the PLC to keep up. However, there are other devices that the PLC cannot track. Incremental shaft encoders, which provide position information, often send thousands of pulses per second. A flow meter used in a process control system may send out hundreds of pulses per second.
Coal mine example
Coal mine Often times the mine is owned by one party while another company will do the actual mining. The company doing the mining will pay for the coal removed from the mine. Therefore the owner installs a measuring system to constantly keep a running total of the coal removed. The coal mine uses a conveyor to continuously remove coal from the mine. In this case a nuclear gamma radiation gage is used to measure the mass of the coal. The gamma gage is a popular choice since the measurement can be made without physical contact of the coal or conveyor. The mass signal from the gage is sent to the PLC along with the conveyor speed (usually a frequency 0 -20 Hz). The PLC multiplies these numbers together and calculates the amount of coal coming out. The PLC then keeps a running total.
Coal mine problem At a mine in South Africa, the PLC being used sent a series of pulses to an electronic counter that displayed the totalized product removed from the mine. The environment was rather harsh and the counters kept failing. Electro-mechanical counters were then installed. However, the reading on the electro-mechanical counters did not match the PLC. How could the simple replacement of an electronic counter with an electro-mechanical counter cause problems? The counters were installed properly and nothing had been tampered with.
Solution The electronic counter can count pulses down to 50 u. Sec or 20 k. Hz. The electromechanical counter had a maximum frequency of 20 Hz and required an activation signal of 20 m. Sec minimum (since time is required to the electromagnetic field to build up enough for the solenoid to physically move the counter mechanism). The PLC was using a one-shot in the logic to pulse the counter. The scan time was around 14 m. Sec, which means the one-shot is only on for 12 m. Sec which was long enough only about 30% of the time to activate the electro-mechanical counter. Moral of the story: Don’t use one-shots in logic that drives outputs directly. Homework: Add the logic necessary to stretch a one-shot pulse into a 25 m. Sec pulse.
Parking garage A parking garage is an example where an up and down counter can be used together to track both garage utilization and to turn on the garage “Full” indicator when no more parking spots are available.
Up/Down example Note how both counters use the same structure C 5
Exercises • Build a program that will count 100 transitions on input #1 then 15 seconds later turn on output #2