Page 1 of 5

Servo Controlling using PIC16F877A

PostPosted: Thu Jun 25, 2009 12:43 am
by himura_ryuu
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~

Re: Servo Controlling using PIC16F877A

PostPosted: Mon Jul 06, 2009 3:12 pm
by hyng
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Jul 10, 2009 7:37 pm
by sahniana
is the PIC used can directly control the servo? or i need to use another PWM chip?

Re: Servo Controlling using PIC16F877A

PostPosted: Sat Jul 11, 2009 11:53 am
by sich
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).

Re: Servo Controlling using PIC16F877A

PostPosted: Wed Jul 15, 2009 9:34 am
by robosang
Better get a servo controller..... save your time and headache a lot!

Re: Servo Controlling using PIC16F877A

PostPosted: Mon Oct 05, 2009 3:44 pm
by kolja
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Tue Oct 06, 2009 5:40 pm
by ober
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Thu Mar 25, 2010 7:38 pm
by Han Giap
hi,

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

thanks in advance :D

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Mar 26, 2010 12:59 pm
by sich
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Mar 26, 2010 9:16 pm
by Han Giap
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