adccommunitymod (AutomationDirect) asked a question.

F2-cp128

Created Date: July 30,2012

Created By: scott.lawrence

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

Still working through this Basic programming... I'm trying to create a handshake when a program starts. I 've created a variable in the CoPro, and I'm sure I don't have it mapped to the PLC bit correctly. The Basic program runs without errors, but the PLC bit doesn't toggle :/ Pointers, anyone?


  • adccommunitymod (AutomationDirect)

    Created Date: July 30,2012

    Created by: bcarlton

    Can you post your BASIC program?

    S205_C(0) = 1 should turn on C0 within the PLC

    S205_C(0) = 0 should turn off C0 within the PLC

  • adccommunitymod (AutomationDirect)

    Created Date: July 30,2012

    Created by: scott.lawrence

    Bernie, this is a snippet from the program. CPHB is the variable I created.

    28 IF TIME>= 64800 THEN 30 ELSE 36

    30 TIME = 0

    32 S205_C(1) = TIME

    34 REM END_IF

    36 IF TIME> CPHB + .5 THEN 40 ELSE 44

    40 S205_C(1) = NOT (S205_C(1))

    42 CPHB = TIME

    It is supposed to toggle the C1 bit in the PLC, but it isn't working like I expected. As stated before, I'm still trying to get back into Basic, since I haven't worked with it since school, some 15+ years...

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: July 30,2012

    Created by: MacS

    This is the only suspect line I see:

    32 S205_C(1) = TIME

    Between the time that line 30 executes to zero TIME and line 32 executes, the TIME value will be non-zero.

    If you want to turn off C1 in line 32 then the line should be:

    32 S205_C(1) = 0

    I loaded the code you showed as is with the addition of line 41 for debug and line 44 to loop back to line 28:

    And C1 toggled every half a second. I saw this:

    >list

    28 IF TIME>=64800 THEN 30 ELSE 36

    30 TIME=0

    32 S205_C(1)=TIME

    34 REM END_IF

    36 IF TIME>CPHB+.5 THEN 40 ELSE 44

    40 S205_C(1)=NOT(S205_C(1))

    41 PRINT1 S205_C(1)

    42 CPHB=TIME

    44 GOTO 28

    PRM 0

    READY

    >run

    65535

    0

    65535

    0

    65535

    0

    65535

    STOP - IN LINE 44

    PRM 0

    READY

    >

    Make sure that the PLC Ladder Logic is not writing to C1 with an OUT or SET coil.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: July 31,2012

    Created by: scott.lawrence

    Mac, this was what I was attempting....I double checked the code I posted against what I had in the CP 128.... the code in the CP 128 had 'ELSE 63 ' instead of 36. Sometimes my dyslexia is a PITA. Thanks guys!

  • adccommunitymod (AutomationDirect)

    Created Date: July 30,2012

    Created by: scott.lawrence

    Still working through this Basic programming...

    I'm trying to create a handshake when a program starts. I 've created a variable in the CoPro, and I'm sure I don't have it mapped to the PLC bit correctly. The Basic program runs without errors, but the PLC bit doesn't toggle :/

    Pointers, anyone?