AVR & low voltage dual motor controller: Code?

Hi all,
I am using AVR128 to control differential steering robots. I have done a code but it does not work. Any body can give me commments and correction:

/// Configuration for dual motor controller
void initMotorsConfiguration()
{
	//Set reset pint
	DDRE = 0b00000100;
	PORTE = 0b00000100;	
	_delay_ms(20);			

        // Configuraiton
	putcharUART0(0x80); // startbyte
	putcharUART0(0x02); // change configuration	
	putcharUART0(0x02); // new settings	
	// reset
	DDRE = 0x00;
	PORTE = 0x00;				
	_delay_ms(20);			

	// set as active mode of motors
        DDRE = 0b00000100;
	PORTE = 0b00000100;	
	_delay_ms(20);							

// send maximum speed to two motors
void robotMotion()
{
	
	putcharUART0(0x80);
	putcharUART0(0x00);	
	putcharUART0(0x50);			
	putcharUART0(0x7F);

}

// Here, putcharUART0 is the function of serial commmunication to send each char value to the motor controller.

Thanks in advance.

Hello,

The configuration should only be done when you want to change it, so you should not have it as part of your code that runs every time. Why do you have a 0x50 in your third byte? The third byte is the motor number and direction, and 0x50 (b’0101 0000’) would mean that you are trying to control motor number 40 (the middle six bits = b’101000’). Typically, the third byte is 0-3 for forward and reverse of the two motors.

- Jan