Can't connect to jrk12v12 by serial

hello…
Im using code vision AVR as compiler and can’t control jrk12v12 by serial communication…
this is the code

printf(“0xAA”);
printf(“0x0B”);
printf(“0x40”);
printf(“0x7F”);
printf(“0xC0 + ( 2500 & 0x1F)”); // Command byte holds the lower 5 bits of target.
printf("(2500 >> 5) & 0x7F"); // Data byte holds the upper 7 bits of target.

is that enough to make the motor rotate with target speed 2500?

thank’s for help)))

Hello. It looks like you are sending ASCII strings to the jrk. The first line of your program sends the byte that is the ASCII encoding of ‘0’, followed by the byte that is the ASCII encoding of ‘x’, etc. The jrk does not support ASCII. You have to send raw, binary bytes. You definitely cannot send the string “0xC0 + ( 2500 & 0x1F)” and expect the jrk to process that math for you.

A byte is simply a number between 0 and 255, also known as 0xFF. To send an actual binary byte with a value of 0xAA in C, you can write:

printf("\xAA");

However, you might need to send a 0x00 byte, and printf is not suitable for that because it takes a 0x00-terminated string. You should see if your programming environment supports some kind of putchar or putc function. Then you can use that to send all your bytes:

putc(0xAA);

Be sure to carefully read the sections of the jrk user’s guide about the serial interface, and configure your jrk to be in the right Serial Mode. Also, if you have not figured out how to control your jrk over USB using the jrk configuration utility, you should really do that before you try to use the serial interface.

–David

thanks, it’s really work.
i want use the board jrk for wall following robot,
according to your opinion, is serial communication fast enough to control the motor speed?)))

I am glad you got the serial communication to work. Yes, it should be fast enough. --David