void servo_left(signed long int speed){PORT_ON(PORTD, 0);delay_cycles(speed);PORT_OFF(PORTD, 0);delay_cycles(200);}void servo_right(signed long int speed){PORT_ON(PORTD, 1);delay_cycles(speed);PORT_OFF(PORTD, 1);delay_cycles(200);} but im not much of a programmer

The examples the others have given use software to generate a pulse. Your original post mentioned PWM. If you want to use hardware PWM then checkout my members tutorial at http://www.societyofrobots.com/member_tutorials/node/228 which discusses PWM and gives an example for driving a servo.