Internet PLC Forum
General => Technical support => Topic started by: tobor0216 on May 31, 2010, 10:44:37 AM
-
I am trying to sense to many time per day my air conditioner runs. I installed a switch in the duct work that has a paddle in it. When the fan turen on the switch is made. The switch is made until the fan turns off.
I want to increment the counter by 1 when the switch is made. The reset the trigger (Input 1) and wait for the next time the switch is mad to increment the counter.
Any Ideas?
I tried the code below
If testbit(Input[1],1)then
C = C+1
Endif
-
Is the switch connected to Input1? Or is there a separate "reset trigger" input?
Assuming your fan sensor switch is connected to an input named: fanSwitch:
(http://fanSwitch1.jpg)
Within the custom function FanSWCnt you can put your statement:
C = C+1
which will increment the counter.
If you have a separate reset switch to reset the counter then you can connect the reset switch to another custom function and then within that CF you run the statement:
C = 0
to reset it.
-
The program of course can also be constructed purely out of ladder logic using the [UpCtr] counter. The maximum range in this case is 1 to 9999. You can cascade multiple counters to expand the range. i.e. when first counter reaches 9999 and roll over to 0 it increments another counter. The range therefore increased to 1-99999999 counts.