adccommunitymod (AutomationDirect) asked a question.

UDC counter words

Created Date: August 03,2004

Created By: KevinS

**** 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.****

Hi, I am using a UDC to count the total number of cycles our machine is doing. I have assigned the preset value to V1405 & V1406. I am counting up to 1 million cycles. I can't figure out how to have the PLC reset the start test bit (C15) when the count reaches my preset value. Everything else on the counter is working great. Thanks for the replies. Kevin


  • adccommunitymod (AutomationDirect)

    Created Date: August 03,2004

    Created by: KevinS

    Hi,

    I am using a UDC to count the total number of cycles our machine is doing. I have assigned the preset value to V1405 & V1406. I am counting up to 1 million cycles. I can't figure out how to have the PLC reset the start test bit (C15) when the count reaches my preset value.

    Everything else on the counter is working great. Thanks for the replies.

    Kevin

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: RHanrahan

    You are going to need to use the CMPD box. This compares one double word to another. First use an LDD to load the UDC current value. then CMPD it to the preset value. On the very next rung look for SP61. This comes on when the result of the compare equal each other. Use this to RST the UDC.

  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: Tech Guy

    The code below should automatically reset the start test bit upon completion. There are other ways of doing this as well such as the second code example.

    Example 1

    | C0

    |-| |---------------|UDC |

    | | |

    | |CT0 |

    |-| |---------------| |

    | |V1405 |

    | C15 | |

    |-| |---------------| |

    |

    | CT0 C15

    |-| |---------------(RST)

    |

    Example 2

    | C0

    |-| |------------------------|UDC |

    | | |

    | |CT0 |

    |-| |------------------------| |

    | |V1405 |

    | C15 | |

    |-| |------------------------| |

    |

    |V1405 CTA0 V1406 CTA1 C15

    |-----|=|-----------|=|-----------(RST)

    |

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: KevinS

    I tried both of the examples above and these are the results.

    It seemed to be running OK but the CT0 bit came on and reset everything when the count reached 64 instead of the setpoint of 100. I am guessing this is some binary to hex conversion or something but I haven't figured it out yet. Anyone know what is happening?

  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: FACTSTech

    You need to enter the double word value in V1405/V1406 as a BCD Double Word.

    It currently seems to be in Binary/Decimal. If you display V1405 in DirectSoft Data View using BCD/HEX and Double Word you should see 100. I would bet that right now it is showing as 64.

    100 Decimal = 64 BCD

    How are you loading the V1405/V1406 double word setpoint value?

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: KevinS

    OK got it, I had the wrong data type set in my EZ Touch program. I changed the data type to BCD_INT_32 from unsigned integer and it worked great. Thanks for the help.

    Kevin

  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: marksji

    If you use the code shown in 'Example 2 ' above don't use the = contacts. Use>= instead. This will keep your code from breaking due to an operator changing the SP to a lower value during run time.

    Using the original code the user can break the program too easily... if the original SP is 150 and the counter has counted as far as 126, but then the operator changes the SP to 107 then your logic never becomes true and nothing ever resets.

    If you use>= then in the above scenario your logic becomes true when the operator inputs the new SP.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: Tech Guy

    Good catch Marksji. You are absolutely correct. I missed that one completely.

  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: bcarlton

    OK - nitpicking time. If the operator were to change the SP to one with the MSW less than the current but with the LSW greater than the current then your comparison would have to wait until the actual LSW reaches the new SP LSW before firing.

    The fix is to parallel the>= test of the LSW with a branch that tests the MSW for NOT =. (Which means the MSW is greater than the MSW SP and an test of the LSW is unnecessary)

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: August 04,2004

    Created by: bcarlton

    How about this?

    ----+----------------- LDD V1405

    |

    +----------------- CMPD CTA0

    |

    +--] SP61 SP62

10 of 18