Author Topic: Can't compile function  (Read 10074 times)

lloyd.maclean

  • Newbie
  • Posts: 7
    • View Profile
    • lloyd's page
Can't compile function
« 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

lloyd.maclean

  • Newbie
  • Posts: 7
    • View Profile
    • lloyd's page
Re:Can't compile function
« Reply #1 on: February 20, 2004, 06:48:55 AM »
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

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Can't compile function
« Reply #2 on: February 20, 2004, 02:51:18 PM »
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



Email: support@triplc.com
Tel: 1-877-TRI-PLCS