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.

Help controlling a servo using 16f877a with c language

Status
Not open for further replies.

alexisjm_04

Newbie level 5
Joined
Mar 1, 2010
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Philippines
Activity points
1,339
Can any one help me to build a code using C to control a servo motor?
I got 16f877a,20xtal,PICC compiler, burner, futaba servo. I know how to blink some LED and use a puch button to turn on LEDs but I want to learn more about mcu, I want to turn the servo defending on the position of the potentiometer.
5K POT is connected on A0 of the PIC, push buttons on E0 and B0, port D will be set as output. I can learn from example using C only unfortunately. I hope that someone can make me a code so that I can get started for my project... Thanks in advance!!! I will be posting my project once it is done.

Help please!...:)
 

can someone give me a code to control 3 servo motor using pic and with a mikroC codes?thanks..
 

when ;you get this code please help mee too i am also trying to control the same motor and if i got first then i will give you ok
 

Yes.. Eng_Bandar ..I would like to study your circuit and source code. Please help me.

I use this following commands in PIC18F452 and it is OK.
I would like to change to PIC16F877A. How I change this commands?
Please help me if you can. Thank....

tmr0h=0xfc;
tmr0l=0xee;
intcon=0xa0;
t0con=0x87;
 

I think both 16F877A and 18F452 has all these registers same. So nothing has to be changed.. This will work for 16F877A.
 

Can any one help me to build a code using C to control a servo motor?
I got 16f877a,20xtal,PICC compiler, burner, futaba servo. I know how to blink some LED and use a puch button to turn on LEDs but I want to learn more about mcu, I want to turn the servo defending on the position of the potentiometer.
5K POT is connected on A0 of the PIC, push buttons on E0 and B0, port D will be set as output. I can learn from example using C only unfortunately. I hope that someone can make me a code so that I can get started for my project... Thanks in advance!!! I will be posting my project once it is done.

Help please!...:)

chek it, hope help u ...
CCS :: View topic - S/W hangs....
 

I think both 16F877A and 18F452 has all these registers same. So nothing has to be changed.. This will work for 16F877A.
Hi gladiss,
thank your reply.
I think..There are different registers.
In..16F877A ..there are no tmr0h (or) tmr0l, only tmr0.
Please How I change..
 

Thanks for pointing out the difference..

INCON=0xA0
remains the same

T0CON= This register is not available for 16F877A. T0 Prescaler is shared with WDT. So You have to set OPTION_REG.
OPTION_REG=0x87(Assuming you are not using WDT and PortB internal Pullups)

TMR0H= This register is not available for 16F877A.
TMR0L= This register is not available for 16F877A.

Use TMR0. This is an 8 Bit Register. The Value You want to set is 0xFCEE. That means Timer0 has to count upto 0x311, which is not possible.
So you have to do a liitle bit coding in your Timer0 Interrupt Routine.
1. First Set Value TMR0=0xEE
2. Declare a Global Variable, say Timer0TimeOut=0.
3. When TMR0 interrupt Occurs Increment this variable, that means, Timer0TimeOut=Timer0TimeOut+1
4. Check, if(Timer0TimeOut>4) then your time is achieved. Do whatever you want here...
if you require timer operation again,
Reset variable Timer0TimeOut=0
TMR0=0xEE, continue the process...
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top