Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

rc servo with dspic30f4011

Status
Not open for further replies.

bhargav07ic

Newbie level 1
Joined
Jun 23, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
ahmedabad
Activity points
1,289
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.
 

What is your clock frequency of dsPIC30F?

Most RC Servos require a PWM period of 20ms and a duty cycle of 1ms to 2ms depending on the required position of the Servo.

How to Interface a Microchip PIC MCU with a hobby R/C Servo

Such low frequency PWM is difficult to achieve using the PWM module of the MCU.

BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top