Welcome, Guest
  • Page:
  • 1
  • 2

TOPIC: Increment counter when rotating for long periods

Increment counter when rotating for long periods 3 weeks 4 days ago #2459

  • Dan_S
  • Dan_S's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
My application is using an SM23375DT motor. I have a section of hose with a weight on the other end. I want to rotate the motor until the hose fails. I use the following for the stoppage after change in torque, which is working fine:

WHILE Bt 'During trajectory...
IF TRQ<1000 'True if string broke
GOTO (10)
ENDIF
LOOP

I found the following "wraparound" code in the manual, but don't know if I've invoked it correctly or not:

IF Bw 'encoder limit reached
PRINT ("Wraparound occurred",#13)
Zw 'reset encoder
ENDIF

My problem is the counter. What would be the code for tracking revolutions, and possibly cascading that variable into another one if it overflows?
Any help would be great; I attached my .sms
Thanks to all

File Attachment:

File Name: VacHoseTorqueLife2.sms
File Size: 1 KB
The administrator has disabled public write access.

Increment counter when rotating for long periods 3 weeks 4 days ago #2460

  • mmeyer
  • mmeyer's Avatar
  • OFFLINE
  • Moderator
  • Posts: 39
  • Thank you received: 11
  • Karma: 3
Hello Dan,

The best way to track motor revolutions is with the index marker on the encoder. You can run an interrupt on the bit that captures the marker, and increment a variable. See the attached program. For wrap-around, you could add an if statement to set the variable back to 0 if it's maxed out, and increment another variable to keep track of total revolutions if that's needed. Hopefully this helps.

Meredith
Attachments:
The administrator has disabled public write access.
The following user(s) said Thank You: Dan_S

Increment counter when rotating for long periods 3 weeks 3 days ago #2461

  • mmeyer
  • mmeyer's Avatar
  • OFFLINE
  • Moderator
  • Posts: 39
  • Thank you received: 11
  • Karma: 3
An alternative is to use the Modulo Limit, which will enable tracking of rotations at the output of a gearhead, considering the ratio. The basic idea is to set the Position Modulo Limit (PML) to the number of encoder counts you wish to define as a single count, and then interrupt on the Modulo Rollover bit (Word 3, Bit 11). See the attached program - note the bit needs to be reset.
Attachments:
The administrator has disabled public write access.

Increment counter when rotating for long periods 3 weeks 3 days ago #2462

  • Dan_S
  • Dan_S's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
Thanks so much for the quick replies, mmeyer !!
Here is the what I hope will accomplish my test, to detect a break in the hose, reset the encoder bit, and track total revolutions.
I don't get any errors, but if you could take a look and give me your thoughts.
Again, thank you for increasing my understanding of these awesome little motors !!
Attachments:
The administrator has disabled public write access.

Increment counter when rotating for long periods 3 weeks 2 days ago #2465

  • mmeyer
  • mmeyer's Avatar
  • OFFLINE
  • Moderator
  • Posts: 39
  • Thank you received: 11
  • Karma: 3
I recommend using only subroutines, placing your C1 and C10 after the "END" line. Note that, as written, your program does not track rotations until after a halt (call to C10) has occurred. Assuming you want to count rotations from the start of motion, you should define and enable interrupts before issuing the "G" command. Also, if you anticipate encoder wraparound to happen at any point, I would set up an interrupt on the bit as well, rather than using the current method of an IF statement, because that will only be evaluated at the point that code is executed.
Attachments:
The administrator has disabled public write access.
The following user(s) said Thank You: Dan_S

Increment counter when rotating for long periods 3 weeks 2 days ago #2466

  • Dan_S
  • Dan_S's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0
This is AWESOME.
I was not aware of the condition to enable interrupts before the go command.
I appreciate all your support on this.
Thanks Much
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.182 seconds
Powered by Kunena Forum