Shop OBEX P1 Docs P2 Docs Learn Events
MMBe HEX & frequency questions. — Parallax Forums

MMBe HEX & frequency questions.

acliffhayacliffhay Posts: 5
edited 2009-01-21 13:26 in BASIC Stamp
Good afternoon. I haven't been here in a long while...it's good to have a project to bring me back!

I'm using a BS2P40 with MMbe to control a Pittman 12VDC gear motor with encoder, and I need to be able to adjust the frequency(Speed) on the fly.

START_UP:

'Send TACH command and read back/display tachometer frequency
'
  SEROUT  FM,1021,[noparse][[/noparse]$55,$82]
  SERIN  TM,1021,500,NO_CONFIRM4,[noparse][[/noparse]B7,B8, B9]
  IF B7 = $AA THEN CONFIRM4
CONFIRM4:
  DEBUG HOME
  DEBUG   "TACH VALUE  = "
  DEBUG   ISHEX2  B8
  DEBUG   ISHEX2  B9,CR
NO_CONFIRM4:
'
'Send SPDCON command, freq. set to 100Hz('0064'h)
'
SpdCon:
  SEROUT  FM,1021,[noparse][[/noparse]$55,$84,$00,$64]
  SERIN  TM,1021,100,NO_CONFIRM5,[noparse][[/noparse]B7]
  IF B7 = $AA THEN CONFIRM5
CONFIRM5:
  DEBUG   "SPDCON MODE",CR
NO_CONFIRM5:
  PAUSE  250

GOTO Start_up




If 100Hz is the absolute slowest speed my motor can handle before it stalls or the MMBe H Bridge just won't activate, how can I calculate the approximate HEX values for a given duty cycle? (ie. 15%, 25%, 33%, 50%, 66%, 75%, 100% ) By using the SetDc command, I can set duty cycle just fine, however, the motor eventually stalls at the slowest setting. If I use the SpdCon command, the MMbe sends more power to the motor to maintain frequency of the tach giving me the extremely slow speeds I am looking for (Total drive ratio = 928.2:1) without stalling. I just can't seem to grasp the best way to find the frequencies I'm looking for and converting them to HEX variables to adjust frequency up or down during runtime. I'm sure you're wondering why I need to go soooo slow...I'm building a rotary welding/soldering/brazing fixture. I don't expect anyone to solve this for me, but some advice pointing me in the right direction would be fantastic! Thanks,

Al

Comments

  • acliffhayacliffhay Posts: 5
    edited 2009-01-20 23:11
    Let me clarify my main question...

    If I need 350Hz (15E), do I code that as

    serout FM,1021,[noparse][[/noparse]$55,$84,$01,$5E]
    



    If I'm correct, then can I create variables, say SPD1 = $01 and SPD2 = $5E and code them like this?

    serout FM,1021,[noparse][[/noparse]$55,$84,SPD1,SPD2]
    



    Al
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-01-21 01:43
    Hi Al, will this work for you.

    Freq_Cmd VAR Word

    Freq_Cmd=Input a value here

    SEROUT FM,1021,[noparse][[/noparse]$55,$84,Freq_Cmd.HIGHBYTE,Freq_Cmd.LOWBYTE]

    Jeff T.
  • acliffhayacliffhay Posts: 5
    edited 2009-01-21 13:26
    Jeff, thanks much, that's exactly what I was missing!

    Al H.
Sign In or Register to comment.