Shop OBEX P1 Docs P2 Docs Learn Events
Unable to run MCP3208 (Eddie motor) and Servo32v7 together — Parallax Forums

Unable to run MCP3208 (Eddie motor) and Servo32v7 together

HoffaHoffa Posts: 46
edited 2015-03-12 19:20 in Propeller 1
Hi,

I have a Eddie controller board. I need to be able to use some servos with the Eddie firmware and added Servo32v7 to the firmware:

Obj

Encoders : "Quadrature_Encoder"
Term : "FullDuplexSerial"
ADC : "MCP3208.spin" ' Works with MCP3008, but two LSBs may be incorrect
Ping : "ReadPulseWidths.spin"
Motors : "Eddie Motor Driver"
Servo : "Servo32v7"

....

Pub Main | rxcheck, NextCNT, LoopCount

Servo.Start
Term.Start(RX, TX, BAUDMODE, BAUDRATE) ' Start a UART for the command port
ADC.Start(ADC_DIO, ADC_CLK, ADC_CS, $FF) ' Continuously run ADC conversions
Ping.Start(@PingResults) ' Continuously read pulse widths on PING))) pins
....

But when I added the Servo the ADC wont work anymore. Before Servo the motors run with the command "GO 70 70" but when I added the SERVO nothing happens.

I have tested to print the cog ids and they seem to be different.

What have I have done wrong?

Comments

  • HarpritHarprit Posts: 539
    edited 2015-03-11 13:55
    We need an absolutely complete program that you are trying to run

    This will not even compile as it is.

    H
  • StefanL38StefanL38 Posts: 2,292
    edited 2015-03-12 04:06
    Harprit is right,

    without the complete code we can do only some guessing.
    The call of the start-methods uses constants. Just a guess:

    Is there a conflict in pin-assignment?

    best regards

    Stefan
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-12 18:04
    The latest version of the Eddie firmware includes a servo command.

    The latest firmware can be found in my GitHub repository ('ddegn").

    I'll add a link when I'm back at my usual computer.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-12 19:20
    Open Propeller Project #8 was about porting the Eddie firmware for use with the Activity Board and HB-25 motor controllers.

    After modifying the code to for the new hardware, I added some additional features to the Eddie firmware such as the "ARC" command and the "SERVO" command. I also improved the way the Ping sensors were read to reduce the interference between sensors.

    I thought the improvements were significant enough to warrant adding these changes to the firmware intended for use with the original Eddie hardware.

    I don't have an Eddie Control Board but I tested the changes with a pair of MC33926 h-bridges and a MCP3208 ADC.

    The video attached to post #40 of the OPP#8 thread shows the new code in action.

    Here are the notes from the comments about how to use the "SERVO" command.
    "SERVO": Sets the pin and pulse length to control a servo. The servo pin
      does not need to be setup before hand. This command can not be used to
      set the two HB-25 controllers used to control the motors (if applicable).
      (The "pin" parameter becomes the "activeServo" value and the pulse length
      parameter becomes the "active parameter". Using the "+", "-", "*" and "/"
      keys will change the position of the servo attached to the pin given in
      the last "SERVO" command. This can be useful in finding the center position
      of a servo.)
    

    So to center a servo attached to P0 you'd send the command:
    SERVO 0 05DC
    

    Hex $05DC is 1500 base ten (center position).

    I've added a "decFlag" which allows one to use base ten numbers with the commands. I found it easier to type base ten numbers into the terminal while testing the code than computing the hexadecimal equivalent.

    I think everything is backwards compatible with the original Eddie firmware. As I mentioned, I don't have the original Eddie hardware so if something doesn't work, let me know and I'll try to fix it.

    You want to download the file "Eddie - Archive . . ..zip."

    Here's a link to the EddieFirmware repository.

    I moved objects which aren't shared by both versions of the firmware to a header file. This allows me to maintain a single instance of the parent object. Only the name of the header file needs to be changed to switch between the two supported hardware configurations.

    BTW, the most recent version of the Servo object is "Servo32v9.spin."
Sign In or Register to comment.