Beginner + Servo


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Location
    Maryland, USA
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    thank you for your quick response!

    please excuse my typo earlier, PIC16F648A is the chip Im using.

    and the "CMCON = 7" at the beginning of my code fixed the problem with my switches not responding.

    My servo will now respond to the switch being toggled, but I would like for my servo to center itself when the switch is in it's center position. I have been reading different versions of controlling servo's via switches, and buttons and have tried my best to combine, into my idea of a logical procedure(not to say the others are not), just trying to write my first bit of code

    again thank you for your response.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Try this-- UNTESTED
    Code:
    start:
    
    'look at switches on Port A
    IF (switchCW = 1) and (switchCCW = 1) then
    GOTO HOME
    ELSE
    GOTO LOOP
    ENDIF
    GOTO start
    
    HOME:
    Position = 150
    Pulsout servo, Position
    pause 18
    GOTO start
    
    loop:
    if SwitchCW = 0 then
    Position = 130
    Pulsout servo, Position
    Pause 18
    endif
    
    If SwitchCCW = 0 then
    Position = 170
    pulsout servo, Position
    Pause 18
    endif
    
    Pause 18
    Goto loop
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  2. saving RCREG to word
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th September 2008, 13:51
  3. Problem with 12F629, servo and EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 1st March 2008, 09:53
  4. Servo does not move
    By ruijc in forum General
    Replies: 12
    Last Post: - 12th November 2007, 19:14
  5. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15

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