Page 4 of 5

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Apr 16, 2010 4:20 pm
by shahrul
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Apr 16, 2010 4:25 pm
by Han Giap
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?

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Apr 16, 2010 5:01 pm
by shahrul
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

Re: Servo Controlling using PIC16F877A

PostPosted: Sun Apr 18, 2010 11:02 am
by Han Giap
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

Re: Servo Controlling using PIC16F877A

PostPosted: Mon Apr 19, 2010 10:46 am
by shahrul
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Fri Apr 23, 2010 7:53 pm
by Han Giap
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

Re: Servo Controlling using PIC16F877A

PostPosted: Wed Jul 14, 2010 6:57 pm
by fitrialif
do you have sample programming for servo using picbasic/basicpro....tq

Re: Servo Controlling using PIC16F877A

PostPosted: Wed Jul 14, 2010 7:15 pm
by shahrul
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.

Re: Servo Controlling using PIC16F877A

PostPosted: Thu Jul 15, 2010 6:23 pm
by fitrialif
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 ????

Re: Servo Controlling using PIC16F877A

PostPosted: Thu Jul 15, 2010 7:44 pm
by shahrul
fitrialif WROTE:hi-tech is software for converting from C to basic/basic pro ????

No, hi-tech is another C Compiler.