by ColdStart » Sat Jan 22, 2011 1:31 am
by ColdStart
Sat Jan 22, 2011 1:31 am
well its really not working at all.. I wonder there were no code for this servo for this popular family of microcontrollers, if i''l be able to make it through im going to post complete schematics and project files...
so, what i did is i set up my PIC32 UART1 to 1000000. UART2 channel intended to talk to PC and PIC is set to 9600... its just for debug.
now, here is how my code looks like:
- Code: Select all
while(1)
{
if (Button1Pressed)
{
LED2On(); //show that button is pressed
// now talk to servo
DIR1(); // direction pin to high
WriteUART1(0xff);
WriteUART1(0xff);
WriteUART1(0x01);
WriteUART1(0x04);
WriteUART1(0x03);
WriteUART1(0x19);
WriteUART1(0x01);
WriteUART1(0xdd);
while(BusyUART1());
DIR0(); // direction pin to low
putsUART2("Command 2 is sent.\r\n");
while (Button1Pressed) ; // wait until button is depressed
} else
LED2Off();
}
and nothing happens... however, when i power my servo, it blinks Once. And in this command, you can see that i am talking to it as its ID is 1... supposed to be factory setting...
ill go ahead debug more, and see what i get from it.. but i just get crap..
ok, here is an update of experiment, i have hooked channel2 of scope to the direction pin connecting from PIC32. And channel1 to the Data pin of AX12...
you can see that 50us duration of high pulse.. means that in my code period from DIR1(); to DIR0()...
and during this period you see what happens on Data pin on channel1... seems like it is what it should be?
two long pulses on chan1 maybe associated somehow with 0xff 0xff...
but the LED does not turn on... ill go ahead do more than that, but it would be nice to hear what you think up until now?
here is picture:
thank you.
http://picpaste.com/pics/Image0047-B6rN0w2w.1295662264.jpg
well its really not working at all.. I wonder there were no code for this servo for this popular family of microcontrollers, if i''l be able to make it through im going to post complete schematics and project files...
so, what i did is i set up my PIC32 UART1 to 1000000. UART2 channel intended to talk to PC and PIC is set to 9600... its just for debug.
now, here is how my code looks like:
- Code: Select all
while(1)
{
if (Button1Pressed)
{
LED2On(); //show that button is pressed
// now talk to servo
DIR1(); // direction pin to high
WriteUART1(0xff);
WriteUART1(0xff);
WriteUART1(0x01);
WriteUART1(0x04);
WriteUART1(0x03);
WriteUART1(0x19);
WriteUART1(0x01);
WriteUART1(0xdd);
while(BusyUART1());
DIR0(); // direction pin to low
putsUART2("Command 2 is sent.\r\n");
while (Button1Pressed) ; // wait until button is depressed
} else
LED2Off();
}
and nothing happens... however, when i power my servo, it blinks Once. And in this command, you can see that i am talking to it as its ID is 1... supposed to be factory setting...
ill go ahead debug more, and see what i get from it.. but i just get crap..
ok, here is an update of experiment, i have hooked channel2 of scope to the direction pin connecting from PIC32. And channel1 to the Data pin of AX12...
you can see that 50us duration of high pulse.. means that in my code period from DIR1(); to DIR0()...
and during this period you see what happens on Data pin on channel1... seems like it is what it should be?
two long pulses on chan1 maybe associated somehow with 0xff 0xff...
but the LED does not turn on... ill go ahead do more than that, but it would be nice to hear what you think up until now?
here is picture:
thank you.
http://picpaste.com/pics/Image0047-B6rN0w2w.1295662264.jpg