Hello and please help me!
I'm doing a soccer robot to participate on Robocup 2005 on Osaka.
My problem if is I make a great number of sucessive calls to functions, the program starts to become "crazy". I have a function called read_sensors, and when I put more than ... calls to other functions (see example bellow) then my program simply do not work. The more strange is that afects not only the function read_sensors, but all the program, inclusive the main function were the function read_sensors...
PLEASE HELP ME!
someone know if is my problem or if that is a compiler problem ?
void read_sensors() {
I2C_Init(100000);
I2C_Start(); // issue I2C start signal
I2C_Wr(0xB0); // send byte via I2C (device address + W)
I2C_Wr(0); // send byte (data address)
I2C_Repeated_Start(); // issue I2C signal repeated start
I2C_Wr(0xB1); // send byte (device address + R)
sensor[0] = I2C_Rd(0u); // Read the data (acknowledge)
I2C_Stop();
Delay_ms(5);
I2C_Init(100000);
I2C_Start(); // issue I2C start signal
I2C_Wr(0xB0); // send byte via I2C (device address + W)
I2C_Wr(1); // send byte (data address)
I2C_Repeated_Start(); // issue I2C signal repeated start
I2C_Wr(0xB1); // send byte (device address + R)
sensor[1] = I2C_Rd(0u); // Read the data (acknowledge)
I2C_Stop();
Delay_ms(5);
I2C_Init(100000);
I2C_Start(); // issue I2C start signal
I2C_Wr(0xB0); // send byte via I2C (device address + W)
I2C_Wr(2); // send byte (data address)
I2C_Repeated_Start(); // issue I2C signal repeated start
I2C_Wr(0xB1); // send byte (device address + R)
sensor[2] = I2C_Rd(0u); // Read the data (acknowledge)
I2C_Stop();
Delay_ms(5);
I2C_Init(100000);
I2C_Start(); // issue I2C start signal
I2C_Wr(0xB0); // send byte via I2C (device address + W)
I2C_Wr(3); // send byte (data address)
I2C_Repeated_Start(); // issue I2C signal repeated start
I2C_Wr(0xB1); // send byte (device address + R)
sensor[3] = I2C_Rd(0u); // Read the data (acknowledge)
I2C_Stop();
Delay_ms(5);
I2C_Init(100000);
I2C_Start(); // issue I2C start signal
I2C_Wr(0xB0); // send byte via I2C (device address + W)
I2C_Wr(4); // send byte (data address)
I2C_Repeated_Start(); // issue I2C signal repeated start
I2C_Wr(0xB1); // send byte (device address + R)
sensor[4] = I2C_Rd(0u); // Read the data (acknowledge)
Delay_ms(5);
I2C_Init(100000);
I2C_Start(); // issue I2C start signal
I2C_Wr(0xB0); // send byte via I2C (device address + W)
I2C_Wr(5); // send byte (data address)
I2C_Repeated_Start(); // issue I2C signal repeated start
I2C_Wr(0xB1); // send byte (device address + R)
sensor[5] = I2C_Rd(0u); // Read the data (acknowledge)
I2C_Stop();
Delay_ms(5);
}
void i2c_motores(char ctrr, char spd){
I2C_Init(100000);
I2C_Start();
I2C_Wr(0xf0); // send byte via I2C (command to 24cO2)
I2C_Wr(ctrr);
I2C_Wr(spd); // send data (data to be written)
I2C_Stop();
}
regards
Compiler problem or my problem?
Re: Compiler problem or my problem?
Please send us the .lst file of your project and we will examine it. I doubt it is the compiler, but let's give it a try.
You can find .lst file in the folder the .hex file is.
The email is: zristic@mikroe.com
You can find .lst file in the folder the .hex file is.
The email is: zristic@mikroe.com