Micro servo controller issues

hi. this is my code i have written to operate the micro serial servo controller… could some one tell me why this dosent work… thanks

// USART initialization: 9600,8N1 @ 8MHz 
#include <avr/io.h>
#include <util/delay.h>

void USART_Transmit(unsigned char data);

int main (void)
{
UCSRA = 0x00; 
UCSRB = 0x18; 
UCSRC = 0x86; 
UBRRH = 0x00; 
UBRRL = 0x33;


while(!(UCSRA & (1<<UDRE)));
UDR = 0x80;
while(!(UCSRA & (1<<UDRE)));
UDR = 0x01;
while(!(UCSRA & (1<<UDRE)));
UDR = 0x40;
while(!(UCSRA & (1<<UDRE)));
UDR = 0x00;
while(!(UCSRA & (1<<UDRE)));
UDR = 0x00;
}

Hello,

Your third byte, the command byte, is not valid. The valid command numbers are 0-5, so I’m not sure why you are trying to send a 0x40.

- Jan

yes your quite right… also should i put it in a loop or not… i tried the comands between 0-5 and i cant get anything to work. it just flashes at me intimidatingly… any other suggestions… it shouldnt be this hard. and i dont really understand what to put for the data bytes for the command… thank you

If you are having problems getting things working, try the simpler Scott Edwards protocol first. You don’t need to put anything in a loop. If you continue having problems and need help, you need to be more specific about what you are doing and what the result is.

- Jan