Servo Controlling using PIC16F877A

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

Servo Controlling using PIC16F877A

Postby himura_ryuu » Thu Jun 25, 2009 12:43 am

Hye~ My recent project was to developed a autonomous robot using PIC16F877A that use 2 servos.
Te requirement was to make the preset for the robot so it'll move according to what we have programmed by not using any sensors. It's sorta like the robot will only move according to the command saved in the memory of the PIC itself..

The problem is, I'm not very familiar with the programming (Both language.. Assembly and C)
So, can anyone give me at least a hint on how i can set the memory of the PIC to give output (servos movement) once it is switched on? I'm kinda stuck as i tried to play with the delay function but it's not the answer i think~ Hahahaha~ Plz help me~
"Q.E.D
Shoumei Shouryou"
himura_ryuu
Apprentice
 
Posts: 34
Joined: Wed May 20, 2009 6:08 pm

Re: Servo Controlling using PIC16F877A

Postby hyng » Mon Jul 06, 2009 3:12 pm

There is a sample source code on controlling a single servo motors. You can find it at servo motor product page http://www.cytron.com.my/viewProduct.php?pid=FSoiOS8HAzsmExERMCkRA7rusBDT9MMCA1HDMMsSzuU=&store= under useful document. Explanation and comment is given in the source code. I'm sure it will be an easy start for you to do your project after understanding the code.
User avatar
hyng
Moderator
 
Posts: 292
Joined: Thu Apr 16, 2009 11:35 am

Re: Servo Controlling using PIC16F877A

Postby sahniana » Fri Jul 10, 2009 7:37 pm

is the PIC used can directly control the servo? or i need to use another PWM chip?
sahniana
Apprentice
 
Posts: 44
Joined: Wed Jul 01, 2009 4:30 pm

Re: Servo Controlling using PIC16F877A

Postby sich » Sat Jul 11, 2009 11:53 am

We need to generate pulses to servo motor signal pin in order to make it rotates to a desired position. The pulses can be generated by a PIC and connect directly to the signal pin. However, the V+ and ground pins are connected to power source at correct voltage. These two wires supply the power to servo motor while signal pin controls the motor. No pwm chip is need and in fact the pulses we need to generate is not pwm but pcm (pulse-code modulation).
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Servo Controlling using PIC16F877A

Postby robosang » Wed Jul 15, 2009 9:34 am

Better get a servo controller..... save your time and headache a lot!
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Servo Controlling using PIC16F877A

Postby kolja » Mon Oct 05, 2009 3:44 pm

Hello,
i am involved in a robotic project and for this it is necessary to control 5 servos separately. So i decided to use a PIC 16F877A and the servo controller SC16.
At first i wanted to test the example program, "SC16A+16F+Pos v1", but i couldn't compile it with MPLAB. Everytime i get the message:

Duplicate chip definition
(Multiple chip definitions detected (option -p<chip> and #include <header.h>).The #include statement should be removed)

I have already tested it without the #include line, but it didnt work.
Does anybody know what to do? Can somebody help me?

Regards,
Kolja.
kolja
Fledgling
 
Posts: 1
Joined: Mon Oct 05, 2009 3:34 pm

Re: Servo Controlling using PIC16F877A

Postby ober » Tue Oct 06, 2009 5:40 pm

Are you using the correct compiler and IDE? The given sample source code is being develop under MPLAB IDE with HI-TECH C PRO compiler.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1442
Joined: Wed Apr 15, 2009 1:03 pm

Re: Servo Controlling using PIC16F877A

Postby Han Giap » Thu Mar 25, 2010 7:38 pm

hi,

can u provide me with <pic.h> file?

thanks in advance :D
Han Giap
Novice
 
Posts: 20
Joined: Thu Mar 25, 2010 7:36 pm

Re: Servo Controlling using PIC16F877A

Postby sich » Fri Mar 26, 2010 12:59 pm

pic.h should come with your HITECH compiler and if you're selecting the right compiler and directories, the compiler will look for the file on its own.
~> How to ask QUESTIONS the SMART way in FORUM? <~
User avatar
sich
Moderator
 
Posts: 603
Joined: Tue Apr 21, 2009 2:15 pm

Re: Servo Controlling using PIC16F877A

Postby Han Giap » Fri Mar 26, 2010 9:16 pm

Thx for the reply :D

i have a problems here..

i test the source code i get from cytron, Single_Servo_16F_20Mhz. I apply the provided
Hex file into my PIC16F877A, all running smooth. But when i recompile using MPlab + High Tech C Compiler, provided from cytron link. i use the compiled hex file, the motor is x working. Can i knw wat the problems?

Thanks in advance
Han Giap
Novice
 
Posts: 20
Joined: Thu Mar 25, 2010 7:36 pm

Next

Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 5 guests