Shop OBEX P1 Docs P2 Docs Learn Events
Motor MIND B with BSpx module — Parallax Forums

Motor MIND B with BSpx module

edited 2007-01-09 00:09 in BASIC Stamp
Hello,

Being complete new to the roboticsworld,·I have a probabily quite easy question. I want to use the motor mind B just for controlling a motor (no tach or brake function). I thought a command like SEROUT 1,1646 [noparse][[/noparse]85,3,127] would make the electrical engines turn at half speed. I also tried it with hexadecimal values, but nothing happens. The Motor mind B receives a valid signal because the green led blinks. After a few hours of search, I'm out of tricks. I'm going to use the SETDC_DIR command. If anyone can give me the code lines he uses for this, please do.

My kindest regards

Comments

  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2007-01-08 13:43
    Philip--

    Here is what I used . . .

    http://www.parallax.com/dl/docs/prod/motors/MotorMindbMan.pdf

    Read the whole thing, but what you really want is the schematic at the bottom of page 10. Works like a charm!

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • edited 2007-01-08 14:05
    Thank you for the reply, but Ihave read the manual (a few times) but still nothing is coming out of the motormind... I think the problem is my software. All the rest seems OK. Can you just post me a basic command line I can run on the stamp? If it doesn't work, I will know something is wrong in my hardware.



    Thank you very much for your help.
  • DaveGDaveG Posts: 84
    edited 2007-01-08 14:25
    Philip,

    The Motormind spec sheet says the default baud rate is 2400 baud.

    Your command SEROUT 1,1646 [noparse][[/noparse]85,3,127] specifies a baud rate of 600. The "1646" = 600 baud.

    You might try changing the "1646" to "396", which is 2400 baud.

    Dave
  • edited 2007-01-08 14:29
    I'm using the BS 2px module. According to themanual the baud rate should be 1646. I tried 396, but then the microcontroller doesn't even blink anymore ...
  • DaveGDaveG Posts: 84
    edited 2007-01-08 14:37
    Philip,

    Silly me. Just after I pushed the send key, I noticed my error. 1646 is correct.

    You might try 18030(inverted) and see what happens.

    Dave
  • DaveGDaveG Posts: 84
    edited 2007-01-08 14:56
    Philip,

    If you are using two power supplies in your setup, the grounds should be connected together, i.e. you
    need a "common" ground for the system.

    Dave G
  • edited 2007-01-08 16:05
    I use one powersource. So the ground should not be a problem.

    The baud rate is correct to· because the green led on the motorcontroller B blinks when I send my information. I think there is something wrong with my last information. I send 85 for synchronisation, 8 for SETDC_DIR command and then -64 (or another deimal beteen +/-127). Is it possible I need to convert this to a hexadecimal or 2's compliment value? And do I need to specify the order of the bits? I tried the hexadecimal and 2's compliments conversion, but it still doesn't work.
  • Vern GranerVern Graner Posts: 337
    edited 2007-01-08 17:20
    Philip Verspreeuwen said...
    I use one powersource. So the ground should not be a problem. The baud rate is correct to because the green led on the motorcontroller B blinks when I send my information. I think there is something wrong with my last information. I send 85 for synchronisation, 8 for SETDC_DIR command and then -64 (or another deimal beteen +/-127). Is it possible I need to convert this to a hexadecimal or 2's compliment value? And do I need to specify the order of the bits? I tried the hexadecimal and 2's compliments conversion, but it still doesn't work.

    THis is the code I used with a BSIIP to control a MMB:

    
    ' ************************
    ' * Conditonal Compile   *
    ' *************************************************************************
    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
        T38K4       CON     6
      #CASE BS2SX, BS2P
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
        T38K4       CON     45
      #CASE BS2PX
        T2400       CON     1646
        T4800       CON     813
        T9600       CON     396
        T19K2       CON     188
        T38K4       CON     84
    #ENDSELECT
    
    
    ' ************************
    ' * Constants            *
    ' *************************************************************************
       ' Motor Mind B Settings
        MMBpin          CON     8     ' Pin to which MMB is connected
        MMBsync         CON     $55   ' Serial com init
        MMBBaud         CON     T2400 ' Serial rate of MMB
        MMBstop         CON     0
        MMBlow          CON     38    ' low speed value
        MMBmedium       CON     75    ' medium speed value
        MMBhigh         CON     255   ' High Speed Value
    
    ' ************************
    ' * Set the motor Speed        *
    ' *************************************************************************
          SEROUT   MMBpin,MMBbaud,[noparse][[/noparse]MMBsync,3,MMBmedium] ' Set the MMB speed 
    
    



    The above code worked with both a MMB (original) and an MMB with the newer firmware. I dont have an MMBe to try it with though... Hope this helps. smile.gif

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
  • edited 2007-01-08 22:52
    I needed something like this. It looks similar to what I made. But maybe I forgot semething. I will test it in two days. Thank you very much for the code. I can't wait to try it out.
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2007-01-09 00:09
    Philip--

    Take a look at Solutions Cubed, the manufacturer of the MMBe. This link has several programs that worked for me.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
Sign In or Register to comment.