I've just received a great RD01 drive system to play around with for a few projects i'm thinking about. I guess the reason i'm thinking about them is because i'm pretty inexperienced with robots and the computer engineering side of things, so bear with me if i ask some silly things!
So, my first step is to get I2C communication working between my Atmega128 (on the compact Robostix board) and the MD23 - and i'm looking for some guidance. I've read through the i2c-tutorial you have on offer (thanks for that) and I'm using the example Colin Sauze's code for the AVR using GCC-AVR for the LCD03 (obviously cutting out the LCD stuff and adapting it for the MD23). I've gotten as far as compiling and building the i2c.c and i2c.h code he has, and then i'm trying a simple bit of code in a main.c file to get her and the green LCD working. Unfortunately, that's where my luck has run out.
I'm running this code below to try and get some action:
- Code: Select all
#include "i2c.h"
#include <avr/io.h>
#include <stdio.h>
int main(void);
int main(void){
i2c_init();
i2c_start();
i2c_transmit(0xB0); //address of the MD23
i2c_transmit(0x00); //First register
i2c_transmit(0x00); //Send it any old thing
i2c_stop();
do // just a loop so i can try and test!
{
i2c_start();
status=i2c_transmit(0xB0);
i2c_stop();
}while (status != I2C_NO_ERROR);
return;
}
Annnd.. the LED light doesn't blink! I've done a bit of poking around, a CRO shows my SCL is low, while i get a waveform on the SDA (which actually looks reasonable, but nothing on the clock). While i'm almost sure that pull-ups are on board, i've tried with a 10k resistor to check if pullups are the problem and yeah, they don't seem to be. So i'm a bit stuck, and unfortunately a bit clueless as to where to go from here.
Any help appreciated - don't assume i've done anything right
Edit: Also just to help, the i2c.c and i2c.h files are downloaded fresh from the /examples page with no changes
