bhargav07ic
Newbie level 1
HI all
I am working on rc servo with dspic30f4011. I am trying to run rc servo with outcompare unit. But it's not working.
software: micro c pro for dspic
code:
void main() {
TRISD= 0x00;
PORTD.B1=1;
TMR2=0x00;
OC1CON=0x0000;
delay_ms(10);
OC1CON=0x0005; // timer 2 is selected
PR2 = 624;
OC1R=200;
OC1RS = 312;
T2CONbits.TON = 0; // Disable Timer
T2CONbits.TCS=1; //external clock
IEC0bits.T2IE = 1; // disable Timer 2 interrupt
T2CONbits.TCKPS = 0b11; // Select 1:256 Prescaler
T2CONbits.TGATE = 0; // Disable Gated Timer mode
T2CONbits.TON = 1; // Start Timer
while(1) asm nop;
}
need help...
THANK YOU.
I am working on rc servo with dspic30f4011. I am trying to run rc servo with outcompare unit. But it's not working.
software: micro c pro for dspic
code:
void main() {
TRISD= 0x00;
PORTD.B1=1;
TMR2=0x00;
OC1CON=0x0000;
delay_ms(10);
OC1CON=0x0005; // timer 2 is selected
PR2 = 624;
OC1R=200;
OC1RS = 312;
T2CONbits.TON = 0; // Disable Timer
T2CONbits.TCS=1; //external clock
IEC0bits.T2IE = 1; // disable Timer 2 interrupt
T2CONbits.TCKPS = 0b11; // Select 1:256 Prescaler
T2CONbits.TGATE = 0; // Disable Gated Timer mode
T2CONbits.TON = 1; // Start Timer
while(1) asm nop;
}
need help...
THANK YOU.