This is still a "Work in Progress" i got my boards in a few weeks ago and am working on getting everything to work how i would like it. You are welcome to use anything that i post, but please if you do use what i provide double check and make sure that things are how you want them.
Ill post with this every thing that i have avaliable.
BOM from digikey,
Circuit Schematic, and
Board Layout
Remove these ads by
Signing UpStep 1: Background/Prototype
since servos operate (typicaly) between 1ms and 2ms, yes i understand there are variations to the actual period for each servo but you get the idea. it is set up such that the 3 output compairs are only at a specific pin for 2ms before they are moved to the next pin. this cycle continues till there is no more servo pins left and foes to a "dummy" state, and then after the 20ms has elapsed the system restarts the servo control. I under stand i may not have said that quite right but ohwell, ill attach some sample code that shows that i mean.
I have 2 designs posted, 1 on the breadboard was the orriginal proof of concept before i designed the board
the final design calls for a 5v regulator the servos, and a 3v regulator for the pic24fj64gb004 and everything in between
=======================================================================================
Code Below
=======================================================================================
void __attribute__ ((interrupt, no_auto_psv)) _T1Interrupt(void) // 20ms
{
// enable the initial settings for an interrup
clock2ms = 0;
//initialize/Reset the 2ms timer
Init2msTimer();
_T2IF = 1;
_T1IF = 0; // clear the interrupt flag
}
void __attribute__ ((interrupt, no_auto_psv)) _T2Interrupt(void) // 2ms
{
// 0-5 represent the 6 servos per Output compair pins
// each case moves the output compair to the respective pins
// enables the servo pin
// sets the output compair value to servo curpos
// default represents that all 6 servo sets have been serviced and to disable the timer
/* case x:
* enable output compare for respective pin
* turn on servo pin
* set output compare value
* disable output compare on previous pin
*
*/
switch(clock2ms)
{
case 0:
// configure the pin
// move OC to the servopp
S1G1PP = OC1_PPS;
S2G1PP = OC2_PPS;
S3G1PP = OC3_PPS;
// Configure the OC
OC1CON1 = 0x0002;
OC2CON1 = 0x0002;
OC3CON1 = 0x0002;
// load value into the OC
OC1R = OneMs;
OC2R = OneMs + OneMs/2;
OC3R = 2*OneMs;
break;
case 1:
S1G1PP = NO_OC;
S2G1PP = NO_OC;
S3G1PP = NO_OC;
// configure the pin
// move OC to the servopp
S1G2PP = OC1_PPS;
S2G2PP = OC2_PPS;
S3G2PP = OC3_PPS;
// Configure the OC
OC1CON1 = 0x0002;
OC2CON1 = 0x0002;
OC3CON1 = 0x0002;
// load value into the OC
OC1R = OneMs;
OC2R = OneMs + OneMs/2;
OC3R = 2*OneMs;
break;
case 2:
S1G2PP = NO_OC;
S2G2PP = NO_OC;
S3G2PP = NO_OC;
// configure the pin
// move OC to the servopp
S1G3PP = OC1_PPS;
S2G3PP = OC2_PPS;
S3G3PP = OC3_PPS;
// Configure the OC
OC1CON1 = 0x0002;
OC2CON1 = 0x0002;
OC3CON1 = 0x0002;
// load value into the OC
OC1R = OneMs;
OC2R = OneMs + OneMs/2;
OC3R = 2*OneMs;
break;
default:
// remove the OC from last servo group to use it.
S1G3PP = NO_OC;
S2G3PP = NO_OC;
S3G3PP = NO_OC;
Disable2msTimer();
break;
}
clock2ms ++;
_T2IF = 0; // clear the interrupt flag
}





































Visit Our Store »
Go Pro Today »



http://www.seeedstudio.com/depot/fusion-pcb-service-p-835.html?cPath=185
they are 5x10 cm boards, and i beleive it was around 25 for 10 boards. wich i think is pretty cheap, the only thing is since i had to get them sent internationaly it took some time to get the boards in. but otherwise