Problems with Pololu Mode Micro SSC

Hi,

I have successfully gotten Micro SSC II mode to work with the controller, servo responds and everything. When I remove the shorting block and try to program in Pololu mode the servo does not respond but the green light comes on indicating serial activity. I tested the PWM signal line with a logic probe and it stays low. In fact, when I leave the shorting block on the servo still responds to the commands no matter which byte sequences (modes) I send it (not supposed to happen right?).
I’m using a PIC18F4520 micro controller. Here’s some sample code:

#include <p18f4520.h>
#pragma config WDT=OFF

int main()
{
	TXSTA = 0xA0;			/* setup USART		*/
	SPBRG = 25;			 /* 9.6 KBAUD @ 4 MHz*/
	RCSTA = 0x80;
	TRISCbits.TRISC6 = 1; // port rc6 tx pin
	TRISCbits.TRISC7 = 1; // port rc7 rec pin
	TRISAbits.TRISA0 = 0; // reset pin
	PORTAbits.RA0 = 1; // send logic 1, to reset

while(1)
{

	/*TXREG = 0xff;	
	TXREG = 8;	
	TXREG = 0x7f; works */

        TXREG = 0x80; // start byte
        TXREG = 0x01; // device id
        TXREG = 0X02; // command, relative pos
        TXREG = 0x07; // servo #8
        TXREG = 0X7F; // move 180 deg

        // above code for Pololu mode, servo does not respond when shorting block off
        // but responds when shorting block on??
}

				  
}

Also, I don’t know why this code needs a while loop. When I don’t use the while loop the servo controller does not respond at all (just yellow). This probably indicates a problem with the micro controller, which probably can’t be solved on this forum. In short, I am having massive problems. Any advice appreciated.

Hello,

From a quick look at your code, I don’t see you waiting for serial transmissions to finish. So, I can imagine a 3-byte buffer allowing the short command to work, but with longer commands, you could be overwriting bytes still waiting in the buffer before they get sent.

As for the while loop question, what happens if you put a while loop after your code? I don’t know what happens when the program execution gets to the end of your program, but maybe that’s causing some kind of reset or other trouble.

- Jan

The problem was the servo controller was not set up for responding to the right server numbers. It’s supposed to respond to 0-7 by default, but this particular chip was set up wrong. I sent it the byte sequences to the change the servo numbers, and now pololu mode works.