Control of servo motor wireless


Results 1 to 9 of 9

Threaded View

  1. #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

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 : 0

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