PBP projects for R/C models


Closed Thread
Results 1 to 40 of 772

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Ken,

    If you're working with PBP, you need to forget about anything you read for the Mikroe BASIC compiler. These are two totally different compilers.

    Everything you need to know about PBP is in the PBP manual. What you don't understand, just ask about here.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    Ken,

    Have you been to this page?
    http://www.melabs.com/resources/samples.htm

    As for routines. I would say that just about every "command" listed in the PBP manual is a routine. ADCIN for example. The routine for reading the chip's ADC is built into that command.

    Keep asking questions
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Smile Success - the wheels go round

    This PWM exercise is designed just for what I have done.

    http://www.melabs.com/resources/samples/pbp/hardpwm.bas

    After loading the .hex into the RC car (carrying my PICkit2), hooking up another battery and connecting CCP1 to the electronic speed control, The wheels spin!!

    Ain't technology grande!

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    COOL!!!
    Another piece down!

    Did you get Walter's PWM reading code to work?
    If so then maybe now you can combine the two.

    If incoming PWM is X then wheels turn sort of thing?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default How does PICkit 2 Logic Tool work?

    As I said, the wheels go round, but...

    The wheels are not going round and round in the pattern I expected. In particular they only go backwards. The code claims to sweep from 20% to 80% cuty cycle.

    SOOO, can I use my USB connection and PICkit 2 Logic and Analyze Tool to see what is actually happening?

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    I believe you are using the PWM example here: http://www.melabs.com/resources/samples/pbp/hardpwm.bas

    This is a PWM that is not supposed to work with RC servo's. It's wave form is different. It is used to dim LED's etc. I am a little surprised that it can turn the wheels at all. I have a scope to help me view wave forms. I have tried for a few minutes to see what the pickit's logic tool can do, but I have not had any success. I am pretty sure it is just a problem with the operator (me).
    Last edited by ScaleRobotics; - 22nd January 2010 at 23:00.

  7. #7
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    This is what the program header says:
    Code:
    ' PicBasic Pro Program to demonstrate hardware PWM.
    ' Output is a 1Khz signal with duty cycle sweeping
    ' from 20% to 80% once per second
    Since the frequency is 1KHz, its period is 1mS. The duty cycle is sweeping from 20% to 80% therefore the pulse width is varying from 0.2mS to 0.8mS. There are 2 problems here. For R/C signals, the period should be 20mS or 50Hz. Second, the pulse width should be 1.5mS for neutral, 1.0mS for extreme left (or full reverse) and 2.0mS for extreme right (or full forward). So your car is responding to a very short pulse (even less than full reverse). You have to modify the values in the program to get it to do what you expect.

  8. #8
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Thank you for your analysis

    Thanks gang.

    I came to much the same conclusion myself. I have been trying to figure out what exactly this PWM code does so that I can modify it meet the RC specs. The comments in the program are fairly clear. My first attempts have not worked but I am optimistic.

    Interesting how rusty my brain has become.

    Ken

  9. #9
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    I gave you that info in post #44.

    Quote Originally Posted by rmteo View Post
    Since the frequency is 1KHz, its period is 1mS. The duty cycle is sweeping from 20% to 80% therefore the pulse width is varying from 0.2mS to 0.8mS. There are 2 problems here. For R/C signals, the period should be 20mS or 50Hz. Second, the pulse width should be 1.5mS for neutral, 1.0mS for extreme left (or full reverse) and 2.0mS for extreme right (or full forward). So your car is responding to a very short pulse (even less than full reverse). You have to modify the values in the program to get it to do what you expect.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11: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, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. Making PBP code more modular
    By forgie in forum General
    Replies: 30
    Last Post: - 25th October 2005, 16:24

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