Shop OBEX P1 Docs P2 Docs Learn Events
Motor Mind B issues — Parallax Forums

Motor Mind B issues

spainespaine Posts: 51
edited 2006-07-29 15:52 in General Discussion
This is the second Motor Mind B that I have tried, and I have yet to turn my motor using it. Worse off, I cannot receive a confirmation from MMB when I send it a command. I am following the basic code that is in the MMB/Paralax notes (See Below). I know my DC motor still works, because I can send pulseout to an H-bridge and I can see some action. However, the MMB's do not work.

I was wondering how one knows that MMB is even alive? is there some test you can run? Can I bring it online without the the +/-MOTOR or the VMOTOR lines hooked up? I'm at my wits end. I mean, a motor controller should be easy, not difficult.

' {$STAMP BS2p}
' {$PBASIC 2.5}

RATE CON 1021 'baud value bs2p 2400BPS

OUTPUT 14
INPUT 15

TM CON 15
FM CON 14
HIGH FM

START_UP:
PAUSE 1000

'Send STOP command

SEROUT FM,RATE,[noparse][[/noparse]$55,$80]
SERIN TM,RATE,100,NO_CONFIRM1,[noparse][[/noparse]B7]
IF B7 <> $AA THEN NO_CONFIRM1
CONFIRM1:
DEBUG "STOP",CR
NO_CONFIRM1:
DEBUG "Could not STOP"
PAUSE 3000


'Send SETDC command, set duty cycle to 'DD'h, or 86.2%,(Dec 221 out of 256 possible)

SEROUT FM,RATE,[noparse][[/noparse]$55,$83,$DD]
SERIN TM,RATE,100,NO_CONFIRM2,[noparse][[/noparse]B7]
IF B7 <> $AA THEN NO_CONFIRM2
CONFIRM2:
DEBUG "SETDC",CR
NO_CONFIRM2:
DEBUG "Could not SETDC"
PAUSE 3000


'Send TACH command and read back/display tachometer frequency. Gate time = 2000ms

SEROUT FM,RATE,[noparse][[/noparse]$55,$82,$80]
SERIN TM,RATE,3000,NO_CONFIRM3,[noparse][[/noparse]B7,B8, B9]
IF B7 <> $AA THEN NO_CONFIRM3
CONFIRM3:
DEBUG "TACH VALUE = "
DEBUG ISHEX2 B8
DEBUG ISHEX2 B9,CR
NO_CONFIRM3:
DEBUG "Could not TACH"
PAUSE 3000


'Send SPDCON command, freq. set to 2500Hz('09C4'h)maintain for 60s; 64 updates/s

SEROUT FM,RATE,[noparse][[/noparse]$55,$84,$09,$C4,$01]
SERIN TM,RATE,100,NO_CONFIRM4,[noparse][[/noparse]B7]
IF B7 <> $AA THEN NO_CONFIRM4
CONFIRM4:
DEBUG "SPDCON MODE",CR
NO_CONFIRM4:
PAUSE 60000


'EXIT SPDCON mode hold FM PIN LOW FOR longer than gate time
LOW FM
PAUSE 16
HIGH FM
PAUSE 25


'Send STATUS command
'
SEROUT FM,RATE,[noparse][[/noparse]$55,$85]
SERIN TM,RATE,100,NO_CONFIRM5,[noparse][[/noparse]B7,B8,B9]
IF B7 <> $AA THEN NO_CONFIRM5
CONFIRM5:
DEBUG "STATUS ",CR
DEBUG "status byte ", ISHEX2 B8,TAB
DEBUG "duty cycle ", ISHEX2 B9,CR
NO_CONFIRM5:
PAUSE 3000
'Return to normal operating mode
'
DEBUG "DONE",CR
GOTO START_UP
END:
jumpin.gifjumpin.gif

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-07-29 07:42
    spaine -

    The first, and biggest problem you have is that the MMC will ONLY operate at 9600 baud, or 38.4 KBPS. You are using 2400 baud, and that's just not going to work.

    Change your RATE·constant as follows. Presently is reads like so:

    RATE CON 1021

    To read as follows:

    RATE CON 84 ' BS-2p 2400 BPS

    That should get you communicating with the MMC. Attached is a Solutions Cubed PDF which is for a slightly different product than the (pure) MMC, but it addresses the use of the PBASIC Stamp BS-2 which you should find helpful. Just remember there are certain differences (mostly in timing) between the BS-2 and the BS-2p. You will have to account for them.

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 7/29/2006 7:55:13 AM GMT
  • spainespaine Posts: 51
    edited 2006-07-29 15:52
    Unfortunately, I am using the MM-B enhanced. If I were using the MM-C, you would be correct.

    The MM-B enahnced can be set to either 2400 or 9600. At first I was just using 2400, as that is factory default, but then I even tried to 9600. I have tried using the change_baud method to flip-flop from 2400 to 9600, but then still nothing communicates. As I showed earlier, when attempting a 2400 BPS connection, I use 1021 and for the 9600 BPS connection, I use 240.

    Any help is greatly appreciated.
Sign In or Register to comment.