MD23 Code Help...
Hello again, I'm having a lot of trouble getting the I2C routines to work with my motor controller, the MD23.
I was wondering if anyone had any spare time on their hands, and if they wanted to make me some sample code that would do just a few simple functions. I'd greatly appreciate it. Or if someone could look at my code and see where i'm going wrong, that would help too...
Here's the information on the motor controller, all the info anyone would need is there. http://www.robot-electronics.co.uk/htm/md23tech.htm#encoders
the only functions i would need would be:
Mode changing from 0 (default) to 1
Disabling the 2second timeout (command found in command register)
Resetting the encoder count (also in command register)
Receiving encoder count.
and of course, setting motor speeds.
any help is greatly appreciated, and if anyone can help me get my robot working they earn my eternal gratitude!
My current code is attached.
p.s. I don't have pull-up resistors on either of the I2C lines, but the I2Cobject that i'm working with says that i don't need them if i initialize it with _driveSCLLine == TRUE. Think this is an issue?
I was wondering if anyone had any spare time on their hands, and if they wanted to make me some sample code that would do just a few simple functions. I'd greatly appreciate it. Or if someone could look at my code and see where i'm going wrong, that would help too...
Here's the information on the motor controller, all the info anyone would need is there. http://www.robot-electronics.co.uk/htm/md23tech.htm#encoders
the only functions i would need would be:
Mode changing from 0 (default) to 1
Disabling the 2second timeout (command found in command register)
Resetting the encoder count (also in command register)
Receiving encoder count.
and of course, setting motor speeds.
any help is greatly appreciated, and if anyone can help me get my robot working they earn my eternal gratitude!
My current code is attached.
p.s. I don't have pull-up resistors on either of the I2C lines, but the I2Cobject that i'm working with says that i don't need them if i initialize it with _driveSCLLine == TRUE. Think this is an issue?
Comments
You must have a pullup on the data (SDA) line. I would recommend having a pullup as well on the clock (SCL) line. The I2C spec requires it even though the Propeller gets away with not having one on the clock line.
okay, i'll get to work on that and see if it works.
still not working... the motor controller isn't even reading any valid I2C data coming through. [noparse]:([/noparse]
I really hope that this controller isn't a waste of $225...
what could be the problem?
physically, i have the stamp and MC powered by 9volts (low for driving motors i know but i'm not running them too hard and i should see SOMETHING!!), then i have pins 0 and 1 pulled to 3.3V, which then go to SDA and SCL on the MC respectively.
i tried beau's i2c lowlevel object (that i got with the SRF08 package) again with no I2C activity.
now i found a BS2 sample program for another product of theirs (a thermistor package). I compiled (to my knowledge) directly from the PBASIC code to spin, but it STILL IS NOT WORKING!
Could someone check my spin and my basic code to see if they're the same... and perhaps if the sample code was decent to begin with? It looks good to me...
Thanks for the continued help.
~~Brian
Graham
will it affect the program if i put wait periods in some places, so i can see the led changing? i wouldn't think so, but i'm not taking any chances at this point.
thanks.
~~Brian
you can be sure that once i get this working i'm going to send them my code :P.
~~Brian
TV/VGA debugging, and everything just works. No need to hook up a bunch of additional stuff. If you value your
time, using the demo board to prototype things is a *great* way to go.
but the LED array would have been nice... oh well. I'll take a trip to the 'shack sometime tonight and give it a whirl.
I'll see what i can do to check out the board. will a simple led suffice? and how should i go about checking the hardware?
~~Brian
http://forums.parallax.com/forums/default.aspx?f=25&m=156661
anyone mind taking a quick peek at my code (Using I2C_toy) and seeing if I am using I2C_toy right?
Something like that.
Graham
Or perhaps try putting the I2C command in a loop, remember it may be so fast that you will not see the indicator LED on your hardware.
Graham
my A0 pin is not functioning correctly!
i'm going to run some programs now to check if they work.
everyone, thanks so much for helping me through this.
~~Brian
my A0 pin is not functioning correctly!
i'm going to run some programs now to check if they work.
everyone, thanks so much for helping me through this.
~~Brian
my A0 pin wasn't working, which used to be my SDA pin.
i changed that, and am now watching the LEDs change correctly, and the motor controller won't even acknowledge a start bit.
so i believe that the second problem was the motor controller itself, for which i am requesting an RMA number.
I'll let everyone here know when i get the new controller how it goes from there.
and i'd like to thank you guys once again for your perseverance.
~~Brian
pub main
dira[noparse][[/noparse]0]~~
outa[noparse][[/noparse]0]~~
waitcnt(cnt+80_000_000*10)
will not light an led connected between the pin and ground. it's distressing, but if i know about it i can avoid other issues.
i actually checked by setting dira~~ and outa~~ and plugging the led into all of the pins consecutively. every other pin functions, save for pin 0.
Graham