Society of Robots - Robot Forum
Software => Software => Topic started by: galannthegreat on February 12, 2009, 08:57:02 PM
-
I've got my servo panning back and forth, but it's not enough, I change for a longer delay and it doesn't change anything. What am I doing wrong?
#include "16f877a.h"
#use delay(clock=20000000)
#fuses HS
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
while(1)
{
output_high(PIN_D0);
delay_us(500);
output_low(PIN_D0);
delay_ms(1000);
output_high(PIN_D0);
delay_us(1500);
output_low(PIN_D0);
delay_ms(1000);
output_high(PIN_D0);
delay_us(2500);
output_low(PIN_D0);
delay_ms(1000);
output_high(PIN_D0);
delay_us(1500);
output_low(PIN_D0);
delay_ms(1000);
}
}
PS I am using a PIC 16F877a and I'm writing the code in CCS C.
-
and wow, I must not be having a good day because this topic is in the wrong category, sorry for any troubles.
-
If it doesn't rotate far enough it might be just the servo. How many degrees is it supposed to rotate?
-
Can you clarify exactly what it is actually doing, and what you want it to specifically do?