Shop OBEX P1 Docs P2 Docs Learn Events
controlling ampflow motor controller with basic stamp????? — Parallax Forums

controlling ampflow motor controller with basic stamp?????

thefitz85thefitz85 Posts: 16
edited 2009-03-31 18:25 in BASIC Stamp
i am currently working on my senior project (autonomous beverage delivery fridge). we seem to be having some issues programming the basic stamp to control the motor controller. power mosfets in motor controller are operated at 16khz pwm. the motor controller receives data in hex form (0 to 127 decimal). we have established communication between pc and motor controller amp, however we cannot seem to manipulate motor movement using commands from the basic stamp. any help would be greatly appreciated. thanks matthew fitzgerald Eastern Maine Community College

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-30 14:49
    How about a schematic and your Stamp source code provided as attachments?
  • thefitz85thefitz85 Posts: 16
    edited 2009-03-30 15:32
    in regard to your response, we are new to the basic stamp. . . . .
    Description:
    Send a speed of position value from 0 to 127 in the forward or reverse direction for a given
    channel. In mixed mode, channel 1 value sets the common forward and reverse value for
    both motors, while channel 2 sets the difference between motor 1 and motor 2 as required
    for steering. In all other modes, channel 1 commands motor 1 and channel 2 commands
    motor 2.
    Syntax: !Mnn
    Where M=
    A: channel 1, forward direction
    a: channel 1, reverse direction
    B: channel 2, forward direction
    b: channel 2, reverse direction
    Where nn= Speed or position value in 2 Hexadecimal digits from 00 to 7F

    Examples:
    !B7F channel 2, 100% forward
    !a3F channel 1, 50% reverse

    we can get the motors turning using the windows hyper terminal. . . .but in order to send these values from the basic stamp do we use serin and serout, and if so can we just assign those to a pin address.

    we also think that we may have an issue with communication between the motor controller and the basic stamp (motor controller config as follows: 9600 bits/s, 7-bit data, 1 Start bit, 1 Stop bit, Even Parity) we must match those values with the basic stamp correct?

    again thanks for your help. we have had this project basically dropped in our laps with only a few weeks left in our program, but of course it is a prerequisite for graduation. any help is good help as we are really struggling through the baby steps. matthew fitzgerald
  • stamptrolstamptrol Posts: 1,731
    edited 2009-03-31 12:39
    matthew,

    As Mike mentioned, we'll be able to help much more with a schematic and the program you're actually running.

    For any serial communication to work, the parameters must be the same on both ends. The Stamps have varying capability at high comm speeds, depending on your program and the model of Stamp. For what its worth, I typically use 2400, 8, N, 1 and 4800, 8, N, 1 on the BS2 and up to 9600, 8,N,1 on the BS2sx and BS2px.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • thefitz85thefitz85 Posts: 16
    edited 2009-03-31 13:29
    i have included the source code that we are using. keep in mind our initial objective is to simply get a response from the motor controller (i.e. the motors). again the motor controller communicates as follows: 9600 bits/s, 7-bit data, 1 Start bit, 1 Stop bit, Even Parity. we are using the BS2. the attached source code does not seem to be working, any help would be greatly appreciated.
    matthew fitzgerald
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-31 16:01
    You say you need 7-bit data with even parity yet your Baud constant doesn't show that.

    From page 419 in the Stamp Basic Manual: 9600 Baud, 7-bit even parity, true logic should be 8276 and inverted logic should be 24660. Try that.
  • thefitz85thefitz85 Posts: 16
    edited 2009-03-31 18:25
    we were able to figure it out. we were communicating at the wrong baud rate, ending up using serout 16, works great. thanks everyone for all of your suggestions
Sign In or Register to comment.