spaine
07-29-2006, 01:02 PM
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,[$55,$80]
SERIN TM,RATE,100,NO_CONFIRM1,[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,[$55,$83,$DD]
SERIN TM,RATE,100,NO_CONFIRM2,[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,[$55,$82,$80]
SERIN TM,RATE,3000,NO_CONFIRM3,[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,[$55,$84,$09,$C4,$01]
SERIN TM,RATE,100,NO_CONFIRM4,[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,[$55,$85]
SERIN TM,RATE,100,NO_CONFIRM5,[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:
http://forums.parallax.com/images/smilies/jumpin.gif http://forums.parallax.com/images/smilies/jumpin.gif
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,[$55,$80]
SERIN TM,RATE,100,NO_CONFIRM1,[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,[$55,$83,$DD]
SERIN TM,RATE,100,NO_CONFIRM2,[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,[$55,$82,$80]
SERIN TM,RATE,3000,NO_CONFIRM3,[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,[$55,$84,$09,$C4,$01]
SERIN TM,RATE,100,NO_CONFIRM4,[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,[$55,$85]
SERIN TM,RATE,100,NO_CONFIRM5,[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:
http://forums.parallax.com/images/smilies/jumpin.gif http://forums.parallax.com/images/smilies/jumpin.gif