PBP projects for R/C models


Results 1 to 40 of 772

Threaded View

  1. #20
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Yes, you have picked a very challenging project.

    The servo part broken down into basic steps of what is going on here. (Other interrupt sources, and different timers could be substituted, but this is what I am using).
    __________________________________________________ _________________________________________________
    Pulse Sensing:
    Using CCP interrupt and calculate (pulse_width = falltime - risetime) with CCP capture low byte CCPR1L and capture high byte CCPR1H (these use Timer1). To do this, bits must be changed from capture on rise, to capture on fall.

    Pulse Width Generation:
    Need to create interrupt from about 1ms to 2ms in length. To do this, we load a timer with pulse width value, bring servo pin high, start timer, when interrupt occurs, bring servo pin low. I used Timer0.

    Pulse Period Generation:
    Need to generate 20ms time frame for sending servo signals. I used Timer2. Servo out pins need to pulse every 20 ms.
    __________________________________________________ _________________________________________________

    On a side note:
    Now just to discombobulate things a little bit (more!), cheating can sometimes work. Problem is, that you want to run one of your outputs through a motor controller, and these don't like cheaters. They like very reliable 20ms time (Pulse Period) frames for the servo pulses. So, where you might have gotten away with using PBP's pulsin and pulsout commands for sensing and controlling servo's, you will not get away with using the pulsout command for controlling your motor controller.

    One place you could get away with a little cheating, is to use Pulsin command to sense your receiver's servo pulses. Then you would not have to worry about the servo Pulse Width sensing. I have used this with an RC autopilot project, and it was smooth enough to fly. But, since you are doing all this work learning about interrupts, and timers, you might as well do it the right way, and measure the pulse with an interrupt.
    Last edited by ScaleRobotics; - 19th January 2010 at 17:51.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 13:55
  2. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 12:26
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 20:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2005, 00:30
  5. Making PBP code more modular
    By forgie in forum General
    Replies: 30
    Last Post: - 25th October 2005, 17:24

Members who have read this thread : 2

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