Unable to run MCP3208 (Eddie motor) and Servo32v7 together
Hoffa
Posts: 46
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?
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
This will not even compile as it is.
H
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
The latest firmware can be found in my GitHub repository ('ddegn").
I'll add a link when I'm back at my usual computer.
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.
So to center a servo attached to P0 you'd send the command:
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."