Internet PLC Forum
General => Technical support => Topic started by: lloyd.maclean on February 20, 2004, 06:48:13 AM
-
I am having a strange problem with this custom function. If I re-arrange the order of the IF-THEN-ELSE statements, it fails at different locations with "Syntax error"??? Is there a limit to the size of the file/ladder diagram/custom function that I am running into?
Thanks,
Lloyd
-
Sorry, here is the code:
IF CtrPV[11]=1 THEN
DM[25]=CtrPV[20]
SETBIT RELAY[42]
ENDIF
IF CtrPV[11]=0 THEN
CLRBIT RELAY[41]
X$=""
W$=""
ENDIF
IF CtrPV[11]=2 THEN
FOR C=0 TO 50
CLRBIT DM[C+100]
CLRBIT DM[C+200]
CLRBIT DM[C+300]
CLRBIT DM[C+400]
CLRBIT DM[C+500]
CLRBIT DM[C+600]
CLRBIT DM[C+700]
NEXT
ENDIF
-
CLRBIT function needs a bit position (0 to 15) besides the variable that you want to clear. So you have to supply the bit position.
E.g CLRBIT DM[C+100], 1
If your purpose is to zero out the DM[C=100], then you should just say:
DM[C+100] = 0