Welcome, Guest

TOPIC: 4 speed changes in 1 turn

4 speed changes in 1 turn 3 years 7 months ago #1769

  • Antoine
  • Antoine's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Hi,
I am struggling to programm my motor (SM23165DT) to have 4 speed changes each turn (speed from 4000 to 12000 counts per second).
I could send a picture of speed curves I wish. Also I would like motor to be able to set/reset outputs on specific encoder position while still monitoring speed efficiently.
Regards

Antoine
The administrator has disabled public write access.

Re: 4 speed changes in 1 turn 3 years 7 months ago #1770

  • csearcy
  • csearcy's Avatar
  • OFFLINE
  • Moderator
  • Posts: 459
  • Thank you received: 77
  • Karma: 23
You may want to try using CAM mode. It will let you turn outputs on and off during the cycle.
You must call the subroutines manually in the example below. For example... GOSUB(40) writes the CAM table.

'Class 5 Demo Short CAM.sms

ECHO 'ECHO on to allow auto addressing downstream
a=1 'set default variable for address 1
WAIT=2000 'wait for boot up time differences
PRINT(#128,"a=a+1",#13) 'each motor prints downstream a=a+1
WAIT=2000 'wait for response time variations
ADDR=a 'Set motor address
WAIT=2000
EIGN(W,0)
ZS
'===========================================================================
'Set up parameters
rr=-1 'Home Direction
vv=100000 'Home Speed
aa=1000 'Home Accel
ee=100 'Home Error Limit
tt=1500 'Home Torque Limit
hh=4000 'Home Offset
mm=90000 'max stroke with room
'===========================================================================
END
C50
a=1000 'ascend and descend distance in slave counts
b=60000 'spool width in slave counts
c=4000 'one rev of spool in master counts
s=b-(a*2) 'calculate MFSLEW distance
m=1000 'gear ratio multiplier
d=1000 'gear ratio divisor
MFMUL=m 'set ratios for gearing
MFDIV=d
MFA(a,1) 'set ascend into ratio distance
MFD(a,1) 'set descend out of ratio distance
MFSLEW(s,1) 'set slew dis. btwn the accel and decel points
MFSDC(c,1) 'set dwell for "c" cnts, auto rev. after dwell
MFR 'set mode to electronic gear ratio
G 'start follwing the external master encoder
RETURN
'=========================================================
C40
CTE(1)
CTA(15,8000)
CTW(0) 'CP=0 {cam pointer or cam index pointer}
CTW(500) 'CP=1
CTW(4000) 'CP=2
CTW(20000)
CTW(45000)
CTW(50000)
CTW(60000)
CTW(65000)
CTW(55000,0,1) 'TURN ON BIT 0 STATUS WORD 8
CTW(46000) 'WILL TURN OFF AT THIS POINT
CTW(45000,0,2) 'TURN ON BIT 1 STATUS WORD 8
CTW(8000) 'WILL TURN OFF AT THIS POINT
CTW(4000)
CTW(500)
CTW(0) 'CP=14
RETURN
'=========================================================
C41
MP PT=0 G TWAIT

SRC(2)
MCE(1) 'spline
MFA(0)
MFD(0)
MFMUL=1
MFDIV=1
MCMUL=1
MCDIV=1
MFSLEW(112000,1)
MFSDC(100,0) 'set dwell for "c" cnts, auto rev. after dwell
MC
G
RETURN
'===========================================================================
C5 'Home routine (Home to Hard Stop)
PRINT("HOME MOTOR",#13)
VT=vv*rr 'Set Home Velocity
ADT=aa 'Set Home Accel
MV 'Set to Velocity Mode
ZS 'Clear any prior Errors
T=tt*rr 'Preset Torque Values
G 'Begin Move towards Hard Stop
MT
WHILE ABS(EA)<ee LOOP 'Loop, While Position Error within limit
PRINT("HIT HARD STOP",#13)
G
WAIT=50 'Wait 50mseconds
O=hh*rr 'Set Origin to home offset
PRINT("MOVING TO ZERO",#13)
MP PT=0 G TWAIT 'Set Motor to Zero
RETURN
'===========================================================================
Last Edit: 3 years 7 months ago by csearcy.
The administrator has disabled public write access.
Time to create page: 0.270 seconds
Powered by Kunena Forum