The best way to control a servo with a PIC


Results 1 to 40 of 42

Threaded View

  1. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    Oh, I thought it might have been simple for a moment there. Since im using 16F i only get 1 hardware UART to play with but im using a MAX485 chip and in the lights the PIC controls the master/slave pins (the 555 method is only used in the main controller). So i can send data to a second chip without it being sent outside the light. I also have 2 spare IO pins so if i use a PIC chip to controll it i can tell it to only listen for serial data if an input pin goes high.

    Now i just have to think of something to do with all those extra IO pins on the second chip. I dont think you can get anything with less than 12 and A/E/USART
    I've used the 16F688 quite a bit, smallest PIC you can get with a built-in USART as far as I know. And if you set it up right, you should be able to run a load of servo's with it...If you set it up right...
    Just a really simple idea off the top of my head...some pseudo-code if you will...
    Code:
    servo1 var porta.whatever...a lot of servo's...
    ...serial port setup...
    
    loop:
    ....check RCREG for new data which is in this format...
    bit7 = 1 = new data actually here, =0 nothing really here :)
    bit6-bit4 = servo select, one of eight
    bit3 = direction
    bit2-bit0 = 3 bits to define the amount to move...
    
    ...now it gets a bit tricky...depending on clock speed of the PIC
    
    ...do the same thing with the servo's that you did with the LEDs, except the servos are on for XXX microseconds, and off for about 18ms or so...
    
    goto loop
    Last edited by skimask; - 14th October 2008 at 17:05.

Similar Threads

  1. More Servo Woes
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 13th May 2009, 08:40
  2. Help with Servo Control Please!
    By wireman22 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th June 2007, 18:15
  3. Servo control / UART / SPI help needed
    By Blackhawk in forum mel PIC BASIC
    Replies: 10
    Last Post: - 10th November 2006, 03:40
  4. How would i write this in pic basic pro (Servo controller)
    By Jhdgkss in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th February 2006, 08:21
  5. Control RC servo via Parallax Servo Control
    By cibotsan in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2005, 08:18

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