Shop OBEX P1 Docs P2 Docs Learn Events
motor control — Parallax Forums

motor control

mmorelandmmoreland Posts: 89
edited 2011-11-22 17:13 in General Discussion
I'm using a stamp to control a motor. The motor accepts a position (P) value to determine how far to spin the shaft. For one revolution, P = 50,000. I am typically sending P = 1000000 for twenty revolutions, but I'd like to be able to modify the P value depending on the situation. I send a command such as SEROUT 1, 500, [Enable, CR, "P3=1000000", CR, "[3", CR] where "enable" activates the motor to receive the P value, P3 means I'm working in a certain bank of speed, accel and position values, and [3 confirms the P value and initiates the move. I'd like the P3 value to be multiples of 1000000 in different situations, but I cannot figure out how to cause the stamp to change the value in the SEROUT statement once I've derived the multiple (an integer from 2 to 20) to use.

Comments

  • $WMc%$WMc% Posts: 1,884
    edited 2011-11-22 17:02
    Could you post some code your using?
    '
    It would help to better understand the problem!
  • ercoerco Posts: 20,259
    edited 2011-11-22 17:13
    Why are your numbers so big? Are you using 50,000 PPR encoders? Especially with a Stamp, wouldn't it be easier to use byte (max value 255) or word (max value 65535) variables?
Sign In or Register to comment.