Micro 8-Servo Serial Controller Buad Rate Problem

Hello,

I am trying to hook up the Pololu Micro 8-servo serial controller to my PIC 18F4520. I had the servo controller working with my BS2 using the sample code under the resources tab for the controller. I am using the PIC for an upcoming school project and I am trying to interface the controller to the PIC. I have been messing around with it and cannot get it to accept a baud rate. It is saying that 9600 is too fast, and 4800 is too slow. I have the board in pololu mode to detect which servo number setting it is in, and then I intend to go back to the MINI SSC mode. Any help is greatly appreciated. Below is my code that I was using to try to detect the servo number setting

#include <18f4520.h>
#include <stdio.h>
#fuses   HS, NOLVP, NOWDT, PUT
#use     delay(clock = 20000000)
#use     rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=pc)
#use     rs232(baud=9600,parity=N, xmit=PIN_B4,rcv=PIN_B3,bits=8,stream=servos)
#use     FAST_IO(B)

void main(void)
{
   set_tris_b(0x00);
   fprintf(pc,"Starting the program!\n\r\n\r");
   delay_ms(1000);
   fprintf(servos,"%u", 128);
   fprintf(servos,"%u", 2);
   fprintf(servos,"%u", 16);
}

Wow, that’s some fancy and unfamiliar compiler syntax.

It looks like you’re just sending ascii strings to the servo controller; that’s what fprintf does (if this fprintf you are using is anything like the standard C fprintf). Neither the Pololu protocol nor the Mini SSC protocol supports ascii strings. You have to send binary bytes using the protocol specified in the user’s guide. Try using some simpler function like fputc that takes a byte and sends it on the serial port.

–David

That was it, thank you very much!!

As for my compiler it’s the CCS compiler that came with the PIC development kit. It’s probably the best I’ve used to far :wink: