PBP projects for R/C models


Closed Thread
Results 1 to 40 of 772

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Just got back into town...

    OKAY,

    I have discovered through the use of my oscilloscope that PAUSE stops the HPWM output pulses. In order to emulate the radio system I want to try giving the ESC two seconds worth of neutral PWM between switches back and forth between forward and reverse. This is a race car. It will not be going backwards very often, but it is necessary sometimes. Looks like I need to figure out how to set a two second interrupt. Hmmmm. NUTS!

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    I have discovered through the use of my oscilloscope that PAUSE stops the HPWM output pulses.
    Hey Ken, welcome back to town.

    Do you mind posting some of your code for us to figure out what is going on? The HPWM command, or using the CCP hardware PWM with your own commands should both work independently of your code. I have a 2 second pause that is repeated, but HPWM keeps pumping out pulses the entire time. But if I repeatedly call HPWM and set it using PBP, it can give me some screwy results. Probably better setting the registers directly, like Bruce shows in this example: http://www.picbasic.co.uk/forum/show...1478#post61478

    What PIC hardware are you using?

    Thanks,

    Walter
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Red face I'm using a 16F887

    Here is the first couple commands of my code. I deliberately start HPWM then PAUSE for four seconds. My oscilloscope shows a flat line for four seconds then springs in PWM action.

    I just looked at it again. I am no longer as certain as I was. Once I get into my code it seems to behave as I expect. I'll get back to you all tomorrow.

    Thanks, Ken

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


    Did you find this post helpful? Yes | No

    Default Here's some code.

    The outputs of PORTC.1 and PORTC.2 are high all the time.
    Why? In other code snippets PAUSE seems to allow action to continue. I hope you guys see that I am being stupid.

    Code:
    ' PORTC.0 'High is R/C.  Low is PIC control
    TRISC = %11110000
    
    main:
    low portc.0
    gosub straightforward
    pause 4000
    goto main
    end
    
    StraightForward:
    pwm 1,120,50
    pwm 2,120,50
    return

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


    Did you find this post helpful? Yes | No

    Default I see it already

    As soon as I typed "submit" I saw that I had left out the H in HPWM. Thank you sooo much!

    Ken

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


    Did you find this post helpful? Yes | No

    Default I also miss wired!!!

    First I used my 44 pin PIC (with no PICKIT 2 board) on a toy level car. Toy level means bang-bang control. It worked.

    Now I am running a model level car with PWM control. I miss wired CCP1 and CCP2. Steering was going to the wheels. Driving was going to the steering servo.

    I thought I had double checked this. Clearly my double checker was flawed. I shall rewire and report back.

    Thank you for your patience.

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


    Did you find this post helpful? Yes | No

    Smile wiring correctly eases understanding BASIC

    Yup,

    Now when it sees something in front it stops then goes backwards. And when nothing is in front it goes forward for all its worth. Such a difference getting the steering servo and the wheel electronic speed control signals actually going to the servo and the ESC.

    Now to calibrate HPWM for this fancy ESC. It seems very similar, but not exactly like the old not-so-fancy ESC. There are still funny rules around switching from forward to reverse and visa verso.

    Ken

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