Servo Controlling using PIC16F877A

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

Re: Servo Controlling using PIC16F877A

Postby shahrul » Fri Apr 16, 2010 4:20 pm

Han Giap WROTE::oops: but i still confuse... when should i write the input for increment?

ADCON0=(ADCON0&0xC7)|(channel<<3); //select analog input channel
wat do this coding means?

If you want to do increments position, you do not need to use read_a2d() function any more. just write position=position+1 or position++

Don't bother with ADCON0=(ADCON0&0xC7)|(channel<<3); it's just to set analog input channel on address ADCON0.

Han Giap WROTE:is it almost the same concept with this 1?
http://www.newcircuits.com/circuit.php?id=uct001

Yes, it almost same. Servo just connect directly; 5V, GND and signal.
Push button, you can do pull-up resistor or pull-down resistor.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Servo Controlling using PIC16F877A

Postby Han Giap » Fri Apr 16, 2010 4:25 pm

shahrul WROTE:
Han Giap WROTE:is it almost the same concept with this 1?
http://www.newcircuits.com/circuit.php?id=uct001

Yes, it almost same. Servo just connect directly; 5V, GND and signal.
Push button, you can do pull-up resistor or pull-down resistor.



hi Shahrul,

which line u write... determine the input for controlling the servo motor?
Han Giap
Novice
 
Posts: 20
Joined: Thu Mar 25, 2010 7:36 pm

Re: Servo Controlling using PIC16F877A

Postby shahrul » Fri Apr 16, 2010 5:01 pm

Han Giap WROTE:
shahrul WROTE:
Han Giap WROTE:is it almost the same concept with this 1?
http://www.newcircuits.com/circuit.php?id=uct001

Yes, it almost same. Servo just connect directly; 5V, GND and signal.
Push button, you can do pull-up resistor or pull-down resistor.



hi Shahrul,

which line u write... determine the input for controlling the servo motor?

TRISA=0b00000001; indicate RA0 as input port.
ADCON1=0b10000000; indicate RA0 as analog port.
You may refer analog/digital configuration table. here
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Servo Controlling using PIC16F877A

Postby Han Giap » Sun Apr 18, 2010 11:02 am

thanks shahrul for u guides,

i hv testing it.. it works on clockwise rotation... only got problem for anti-clockwise... it is becoz of noise within the circuit? or my coding got problem?


#define min 10
#define max 50

static void interrupt isr(void)
{
if(TMR0IF==1){
TMR0IF=0;
counter++;
if(counter==position) SERVO=0;
if(counter==position1) SERVO1=0;
if(counter==position2) SERVO2=0;
if(counter==390){
counter=0;
SERVO=1;
SERVO1=1;
SERVO2=1;}}}
if(a=='3')
{if(position<max) position=position+1;}
if(a=='4')
{if(position<min) position=position-1;}

thanks again.. and to everyone that have been helping me thanks :D
Han Giap
Novice
 
Posts: 20
Joined: Thu Mar 25, 2010 7:36 pm

Re: Servo Controlling using PIC16F877A

Postby shahrul » Mon Apr 19, 2010 10:46 am

Han Giap WROTE:i hv testing it.. it works on clockwise rotation... only got problem for anti-clockwise... it is becoz of noise within the circuit? or my coding got problem?

If your coding not problem, you may consider servo power source. Because you move 3 servo, need more current from voltage regulator 7805. Find schematic for increase 7805 current.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Servo Controlling using PIC16F877A

Postby Han Giap » Fri Apr 23, 2010 7:53 pm

hi,

Shahrul... i found out what is wrong already..

this statement

if(a=='4')
{if(position<min) position=position-1;}

which should be..

position>min

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

Re: Servo Controlling using PIC16F877A

Postby fitrialif » Wed Jul 14, 2010 6:57 pm

do you have sample programming for servo using picbasic/basicpro....tq
User avatar
fitrialif
Freshie
 
Posts: 4
Joined: Wed Jul 14, 2010 6:34 pm
Location: unisel,bestari jaya

Re: Servo Controlling using PIC16F877A

Postby shahrul » Wed Jul 14, 2010 7:15 pm

fitrialif WROTE:do you have sample programming for servo using picbasic/basicpro....tq

No, I don't have. Maybe you can edit from C Programming using Hi-Tech.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Servo Controlling using PIC16F877A

Postby fitrialif » Thu Jul 15, 2010 6:23 pm

shahrul WROTE:
fitrialif WROTE:do you have sample programming for servo using picbasic/basicpro....tq

No, I don't have. Maybe you can edit from C Programming using Hi-Tech.


hi-tech is software for converting from C to basic/basic pro ????
User avatar
fitrialif
Freshie
 
Posts: 4
Joined: Wed Jul 14, 2010 6:34 pm
Location: unisel,bestari jaya

Re: Servo Controlling using PIC16F877A

Postby shahrul » Thu Jul 15, 2010 7:44 pm

fitrialif WROTE:hi-tech is software for converting from C to basic/basic pro ????

No, hi-tech is another C Compiler.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

PreviousNext

Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 2 guests

cron