News:

  • June 08, 2026, 05:27:57 PM

Login with username, password and session length

Author Topic: Math Logic NOT working all the time  (Read 8391 times)

eric14779

  • Full Member
  • ***
  • Posts: 30
Math Logic NOT working all the time
« on: July 26, 2012, 09:01:08 AM »
 I have a DL250-1 CPU, LookoutDrect, H2-CTRIO based motion control project I am fighting, I do not think my formats or operators are right....

I have attached a PDF file of the stage of code.

The first thing it does is read the CTRIO registers. I think I got this right (came from manual chapter 8 page 11)

Next it advances the "Pointer" (CTA0) to get the next move count from LKD. I am assuming that there can be a lag until V10000 is updated so I have a delay built in ONDTMR T40 (set to 1 sec) It seems to help with data starvation.

Then I start some basic math to determine the next move distance (in counts) I convert my Decimal values from LKD & CTRIO to BCD, Then I load the next position ( V11000) and I subtract the Current Position (V11002) and OUT the result to ( V10004) "Difference" And set C30 (difference calculated)

Now I LDD my max carriage travel (d282 hex) convert to BCD, OUTD to V12000 (to use in data view), then SUBD V11020 (current stroke count BCD value from the CTRIO) OUTD V10006 Remaining Travel, then CMPD to V10004 difference.

The next Rung is where I use the SP60 (less than) and SP70 (Negative) to decide if I need to JUMP to the "Regrip" Stage (making sure that the CTRIO has been read, Difference calculated and the Delay timer has elapsed. If TRUE the it sets some things and jumps to the REGRIP stage.

Also I need to do a regrip when the front end of the part is out far enough so the far end clamp on the carriage can grip it (rung 13 & 14)

then Rung 15 assumes that the other 2 conditional checks are false and Jumps to the GOTO Stage witch loads the new V10000 value to the Parameter 3 of the CTRIO and makes the move.

Am I doing something wrong?

How can I code to be sure I am getting the DATA from LKD without using a delay timer ?

Is the delay timer bulletproof ??
Attached Files
File Type: pdf    Punch Fired Stage.pdf (23.3 KB, 0 views)


There are no comments for this topic. Do you want to be the first?