adccommunitymod (AutomationDirect) asked a question.

DL06 Hi Speed counter

Created Date: May 01,2006

Created By: KeithFutter

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

I have an encoder connected to the X1 input of a DL06. The counter is set up in Mode 10 with a single input. The counter counts up to a pre-set number which is loaded from V memory. The counter is self-reset when the count reaches the pre-set number. My problem is that the counter occasionaly resets one pulse before reaching the pre-set count. Count speed is 400 Hz.


  • adccommunitymod (AutomationDirect)

    Created Date: May 01,2006

    Created by: bcarlton

    Exactly how are you determining that it resets one pulse before the pre-set count? Can you post your logic?

  • adccommunitymod (AutomationDirect)

    Created Date: May 02,2006

    Created by: KeithFutter

    With 'status ' switched on I can watch the incoming pulses to the UDC on the computer. Turning the encoder shaft very slowly, I can see the count increase pulse by pulse until it reaches the number at which it resets (say, 100). Occasionally it resets at 99.

    I can send the ladder diag to you, but I can't see how to post it on this board.

    Keith

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 02,2006

    Created by: bcarlton

    You can use File - Export - Program to get a text file. As long as the program isn't very long go ahead and post the entire text file by cut-and-paste.

    If the 100th pulse occurs after the execution of the counter instruction you may see the count via communication at the end of the scan. Then on the next scan the counter resets. Actually I'm somewhat suprised that you could even see the terminal count.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 03,2006

    Created by: bcarlton

    Thanks for the program via email, though since you just sent the PRJ file I have no documentation or register values. If it's important for me to see the documentation and values then zip up all the files with the name of your project and email that. If you wish others to help then follow my earlier post, export the project, then cut and paste the text result into a post.

    Which value are you looking at for the count, CTA174 or its doubled value in V2002? I'd still be suprised if you do actually catch the final value. Since achieving the final value is used to reset the counter.

    You said that the signal is at 400hz. What is the scan time of your program? Since 400hz generates a count every 2.5ms then a scan time of more than that will occasionally see an increase in the accumulated count of more than one count in a scan.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 03,2006

    Created by: KeithFutter

    Thanks for your reply.

    Prog cut and pasted below as you suggest.

    The encoder produces 100pprev, each pulse reresenting 2mm. The value in V2000 is the desired distance in mm as set on an Optimate 413 HMI.

    The value is then multiplied by 5 and divided by 10 and used as the preset vale in the counter. This way, 200mm distance as set on the Optimate is counted as 100pulses in the counter, which is one rev of the encoder.

    Turning the encoder many times with 200mm set, causes the punches to punch at one rev of the encoder shaft - 200mm - with an occasional punch at 198mm.

    I beleive the scan time is less than 2mS and the program is very small, so it should be quick.

    I could imagine missing pulses if the scan time was too long, but doesn't the HSIO mode ensure that only true incoming pulses are counted, one for one?

    Keith

    PLC 06

    // Rung 1

    // Address 0

    #BEGIN COMMENT

    "Set up hi speed ctr for mode 10 incremental mode "

    #END

    STR SP0

    LD K10

    OUT V7633

    LD K101

    OUT V7634

    LD K1006

    OUT V7635

    LD K107

    OUT V7636

    LD K1006

    OUT V7637

    // Rung 2

    // Address 11

    STR SP1

    LDD CTA174

    MUL K2

    OUTD V2002

    LD V2004

    OUT V2020

    // Rung 3

    // Address 17

    STR SP1

    LD V2000

    MUL K5

    DIV K10

    OUT V2014

    // Rung 4

    // Address 22

    STR SP1

    STRN SP1

    STR SP0

    OR C55

    ORN Y15

    OR CT174

    UDC CT174 V2014

    // Rung 5

    // Address 30

    STR CT174

    SETI Y17

    // Rung 6

    // Address 32

    STR Y17

    STRE TA250 V2020

    OR SP0

    OR C55

    TMRAF T250 K3

    // Rung 7

    // Address 40

    STRE TA250 V2020

    OR SP0

    RST Y17

    // Rung 8

    // Address 44

    STR X12

    PD C55

    // Rung 9

    // Address 46

    STR X1

    PD C50

    // Rung 10

    // Address 48

    STR C50

    STR CT5

    OR C55

    OR SP0

    CNT CT5 K2

    // Rung 11

    // Address 55

    STRE CTA5 K1

    OUT Y15

    // Rung 12

    // Address 58

    STR X4

    PD C110

    // Rung 13

    // Address 60

    STR C110

    STR CT10

    OR SP0

    CNT CT10 K2

    // Rung 14

    // Address 66

    STRE CTA10 K1

    OUT Y7

    // Rung 15

    // Address 69

    STR Y7

    AND Y17

    AND Y15

    OUT Y1

    // Rung 16

    // Address 73

    STR X5

    PD C120

    // Rung 17

    // Address 75

    STR C120

    STR CT20

    OR SP0

    CNT CT20 K2

    // Rung 18

    // Address 81

    STRE CTA20 K1

    OUT Y10

    // Rung 19

    // Address 84

    STR Y10

    AND Y17

    AND Y15

    OUT Y2

    // Rung 20

    // Address 88

    STR X6

    PD C130

    // Rung 21

    // Address 90

    STR C130

    STR CT30

    OR SP0

    CNT CT30 K2

    // Rung 22

    // Address 96

    STRE CTA30 K1

    OUT Y11

    // Rung 23

    // Address 99

    STR Y11

    AND Y17

    AND Y15

    OUT Y3

    // Rung 24

    // Address 103

    STR X7

    PD C140

    // Rung 25

    // Address 105

    STR C140

    STR CT40

    OR SP0

    CNT CT40 K2

    // Rung 26

    // Address 111

    STRE CTA40 K1

    OUT Y12

    // Rung 27

    // Address 114

    STR Y12

    AND Y17

    AND Y15

    OUT Y4

    // Rung 28

    // Address 118

    STR X10

    PD C150

    // Rung 29

    // Address 120

    STR C150

    STR CT50

    OR SP0

    CNT CT50 K2

    // Rung 30

    // Address 126

    STRE CTA50 K1

    OUT Y13

    // Rung 31

    // Address 129

    STR Y13

    AND Y17

    AND Y15

    OUT Y5

    // Rung 32

    // Address 133

    STR X11

    PD C160

    // Rung 33

    // Address 135

    STR C160

    STR CT60

    OR SP0

    CNT CT60 K2

    // Rung 34

    // Address 141

    STRE CTA60 K1

    OUT Y14

    // Rung 35

    // Address 144

    STR Y14

    AND Y17

    AND Y15

    OUT Y6

    // Rung 36

    // Address 148

    END

    // Rung 37

    // Address 149

    NOP

    #BEGIN ELEMENT_DOC

    "X1 ", "START Punching ", " ", " "

    "X4 ", "Select Pnch1 btn ", " ", " "

    "X5 ", "Select Pnch2 btn ", " ", " "

    "Y1 ", "Sol valve 1 ", " ", " "

    "Y7 ", "Pnch1 selected ", " ", " "

    "Y10 ", "Pnch 2 selected ", " ", " "

    "Y15 ", "Started ", " ", " "

    "Y17 ", "Punch down ", " ", " "

    "T250 ", "Punch down timer ", " ", " "

    "CT5 ", "Start/stop punch ", " ", " "

    "CT174 ", "Length ctr ", " ", " "

    "CTA174 ", "Current dist mm ", " ", " "

    "V2000 ", "Desired length ", " ", " "

    "V2002 ", "Dist travelled ", " ", " "

    "V2004 ", "Punch down time ", " ", " "

    "V2014 ", "Pre-set lngth ", " ", " "

    #END

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 03,2006

    Created by: bcarlton

    If your encoder is a quadrature type you may wish to try mode 20, just in case there is any oscillation enough, especially near the punch point, to cause an extra count.

  • adccommunitymod (AutomationDirect)

    Created Date: May 01,2006

    Created by: KeithFutter

    I have an encoder connected to the X1 input of a DL06. The counter is set up in Mode 10 with a single input. The counter counts up to a pre-set number which is loaded from V memory. The counter is self-reset when the count reaches the pre-set number.

    My problem is that the counter occasionaly resets one pulse before reaching the pre-set count. Count speed is 400 Hz.

    Expand Post