Internet PLC Forum
General => Technical support => Topic started by: lloyd.maclean on February 13, 2004, 01:09:55 PM
-
I can't figure out why this statement in a custom function does not work...
IF CtrPV[9]=1 THEN
SETBIT OUTPUT[1],0
ENDIF
Thanks,
Lloyd
-
The logic you have listed will work in a [CusFn] as it is scanned continuously. If you use it in a [dCusF] it will only work if the rung goes true when the counter = 1. Try it with the [CusFn] and see if it works for you.
Brian Ferry
BLF Electronics
-
How is the counter CtrPV[9] being changed? It must have a chance of being changed in some part of the ladder program or in interrupt service routine so that when you check the value of CtrPV[9] there will be a chance that the counter #9 present value can reach 1. It should work.
When you execute SETBIT OUTPUT[1],0 you are trying to turn on Output #1. But is this output also controlled by any ladder logic rung? If so, then the SETBIT OUTPUT[1],0 will only change the output bit for 1 scan time until another part of the ladder program changes it back and that may be the reason you did not see that the output has changed.
-
Thanks support, you hit the nail on the head!