Control of servo motor wireless


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2008
    Posts
    81

    Default Control of servo motor wireless

    I'm unable to control a servo wireless
    someone can help me
    need to control 2 motor and a servo motor.
    THANK YOU

    A VAR BYTE
    B VAR BYTE
    C VAR BYTE
    D VAR BYTE
    E VAR BYTE
    X VAR BYTE


    PAUSE 900
    lcdout $FE,1,"P1 P2 P3 P4"

    PROG:
    GOSUB LCD
    ADCIN 0,A
    ADCIN 1,B
    ADCIN 2,C
    ADCIN 3,D
    ADCIN 4,E:X=(E+20)
    PAUSEUS 50
    hserout ["PC",A,B,C,D,X]
    GOTO PROG

    LCD:
    lcdout $FE,$C0,dec3 A," ",dec3 B," ",dec3 C," ",DEC D," "
    pause 200
    RETURN


    A VAR BYTE
    B VAR BYTE
    C VAR BYTE
    D VAR BYTE
    E VAR BYTE


    PROG:
    hSerIn [WAIT("PC"),A,B,C,D,E]
    if (A>160) THEN FRE
    IF (A<100) THEN TRA
    IF (B>160) THEN DIR
    IF (B<100) THEN ESQ

    pulsout PORTB.0,E 'SERVO MOTOR


    PORTC.0 = 0
    PORTC.1 = 0
    PORTC.2 = 0
    PORTC.3 = 0
    PORTC.5 = 0
    GOTO PROG

    FRE:
    PORTC.0 = 1
    PORTC.1 = 0
    PORTC.2 = 0
    PORTC.3 = 1
    PORTC.5 = 1
    GOTO PROG

    TRA:
    PORTC.0 = 0
    PORTC.1 = 1
    PORTC.2 = 1
    PORTC.3 = 0
    PORTC.5 = 1
    GOTO PROG

    DIR:
    PORTC.0 = 1
    PORTC.1 = 0
    PORTC.2 = 1
    PORTC.3 = 0
    PORTC.5 = 1
    GOTO PROG

    ESQ:
    PORTC.0 = 0
    PORTC.1 = 1
    PORTC.2 = 0
    PORTC.3 = 1
    PORTC.5 = 1
    GOTO PROG

  2. #2
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    A bit more information needed. What chip? ADCON settings? HSERIN/OUT settings?

    Is this what you mean (Renamed slightly for clarity in MCS)

    GOSUB LCD probably wants to be at end of PROG as first run will show no values.

    Code:
    A VAR BYTE
    B VAR BYTE
    C VAR BYTE
    D VAR BYTE
    E VAR BYTE
    X VAR BYTE
    
    
    PAUSE 900
    lcdout $FE,1,"P1 P2 P3 P4"
    
    PROG:
    GOSUB LCD
    ADCIN 0,A
    ADCIN 1,B
    ADCIN 2,C
    ADCIN 3,D
    ADCIN 4,E:X=(E+20)
    PAUSEUS 50
    hserout ["PC",A,B,C,D,X]
    GOTO PROG
    
    LCD:
    lcdout $FE,$C0,dec3 A," ",dec3 B," ",dec3 C," ",DEC D," "
    pause 200
    RETURN
    
    
    ;-------------------------------------------------------------------------
    ;Wireless receiver
    
    A1 VAR BYTE
    B1 VAR BYTE
    C1 VAR BYTE
    D1 VAR BYTE
    E1 VAR BYTE
    
    
    
    PROG1:
    hSerIn [WAIT("PC"),A1,B1,C1,D1,E1]
    if (A1>160) THEN FRE
    IF (A1<100) THEN TRA
    IF (B1>160) THEN DIR
    IF (B1<100) THEN ESQ
    
    pulsout PORTB.0,E1 'SERVO MOTOR
    
    
    PORTC.0 = 0
    PORTC.1 = 0
    PORTC.2 = 0
    PORTC.3 = 0
    PORTC.5 = 0
    GOTO PROG1
    
    FRE:
    PORTC.0 = 1
    PORTC.1 = 0
    PORTC.2 = 0
    PORTC.3 = 1
    PORTC.5 = 1
    GOTO PROG1
    
    TRA:
    PORTC.0 = 0
    PORTC.1 = 1
    PORTC.2 = 1
    PORTC.3 = 0
    PORTC.5 = 1
    GOTO PROG1
    
    DIR:
    PORTC.0 = 1
    PORTC.1 = 0
    PORTC.2 = 1
    PORTC.3 = 0
    PORTC.5 = 1
    GOTO PROG1
    
    ESQ:
    PORTC.0 = 0
    PORTC.1 = 1
    PORTC.2 = 0
    PORTC.3 = 1
    PORTC.5 = 1
    GOTO PROG1
    Last edited by tasmod; - 10th April 2014 at 12:51.
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  3. #3
    Join Date
    Aug 2008
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    hello tasmod
    Thanks for responding to my message
    I need ponteciometro stay in the middle and the servant is in the center to divide right and center left.
    Could you help me with this
    thank you

  4. #4
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    Need to know which PIC chip you are using.

    What other settings you have made. Such as ADCON HSERIN etc.
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  5. #5
    Join Date
    Aug 2008
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    hello tasmod
    When the potentiometer Reaches the end the servant is out of position
    here s configuration Requested that I am using
    thank you

    DEFINE OSC 4
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 25
    DEFINE HSER_CLROERR 1

    DEFINE ADC_BITS 8
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    ADCON1=%1001001

  6. #6
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    Please say which PIC you are using

    Is it 16f88 or 16f877 or an 18f
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  7. #7
    Join Date
    Aug 2008
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    01 pic16f876a tx
    01 pic16f876a rx
    excuse me

  8. #8
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    Quick look shows ADCON0 doesn't have enough bits set. There's only 7

    ADCON1 ??

    Code:
    ADCON1 = %10000100    ' Set PORTA analog and RIGHT justify result
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  9. #9
    Join Date
    Aug 2008
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Re: Control of servo motor wireless

    I USE 5 pot
    01 POT LEFT AND RIGHT
    01 POT DOWN AND UP
    01 SERVO POT

Similar Threads

  1. Servo Motor control using MATLAB and PIC.
    By shirohin in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2012, 02:44
  2. Servo motor control
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th July 2010, 22:44
  3. servo motor control??help
    By HYETİK in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th April 2009, 07:41
  4. control servo motor by using pic16F84A
    By waterlee2000 in forum PBP Wish List
    Replies: 10
    Last Post: - 23rd June 2006, 14:31
  5. inturrepts to control the servo motor position!
    By parinshah in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd May 2006, 07:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts