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 in Controlling servo using 16F877a

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?
I got a servo motor,16f877a,20MHz xtal,PICC compiler,I have a burner for my PIC and I use C when writing a program. I got a 5k pot connected to pin A0 and I am planning to use port D to control the servo to go left and right when I turn the pot. The problem is I don't know how to start .... I really wanted to learn more about the MCU and I tried blinking LEDs an and using push buttons before, I hope that someone can help me with complete codes so that I can get strated , I can learn form exmaples.Thanks in advance!!
 

Hi,
Take a look at these:
Code:
http://www.pyroelectro.com/tutorials/servo_motor/index.html
[url]http://www.imagesco.com/articles/picservo/01.html[/url]
[url]http://www.imagesco.com/articles/picservo/02.html[/url]
[url]http://www.rentron.com/SerialServo.htm[/url]
[url]http://www.rentron.com/PICX5.htm[/url]
[url]http://www.mcmanis.com/chuck/robotics/projects/servo.html[/url]
[I]**broken link removed**[/I]
[url]http://www.best-microcontroller-projects.com/servo-motor.html[/url]
Hope this helps.
Tahmid.
 

I tried to review the links that you gave but they are all using ASM, can you help me to build my project usign C? I got a picture here and my codes. I'm not sure if it is correct.
 

Hi,

Here is my code I just copied it and it seams that it only display the value of the adc on port D , hope you can help me, thanks in advance!



Code:
#include <16f877.H>

#fuses xt,noPROTECT,noWDT,noPUT,noBROWNOUT,nolvp,nowrt

#use delay(clock=20000000)

#use standard_io(a) // set io port a
#use standard_io(b) // set io port b
#use standard_io(c) // set io port c
#use standard_io(d) // set io port d
#use rs232(baud=9600, xmit=pin_c6, rcv=pin_c7) // set rs232 port

main(){
int value; // aset up storage in memory
setup_port_a(ALL_ANALOG); // se port a to all analoges
setup_adc(adc_clock_div_2); // set up adc
setup_timer_2(T2_div_by_4,0xc0,2); // initialize timer 2
setup_ccp1(ccp_pwm); 

while (1) 
{
set_adc_channel(0); // adc A0
delay_us (5); 
value= read_adc(); 
delay_ms (100); 

output_d(value);

}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top