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 Success!!!

    The following code makes the car go full speed backwards, then stop, then full speed forwards, then stop etc. Using the RC system I can control the motor continuously though varying speed. I have not yet figured what HPWM parameters produce various speeds to the ESC. It may be that the over-specification fast pulse frequency is overriding that nuance.

    To really discover what this is doing I need to study and understand the ASM code. I think HPWM is interrupt driven. I am concerned because page 87 of the PBP Manual seems to say that the slowest pulse frequency is 245 hz. I want 50 hz.

    Code:
    '****************************************************************
    '*  Name    : HPWMcommand.BAS                                   *
    '*  Author  : Ken Jones                                         *
    '*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS] *
    '*          : All Rights Reserved                               *
    '*  Date    : 1/27/2010                                         *
    '*  Version : 1.0                                               *
    '*  Notes   : PBP has a HPWM command.  Let's try it.                                                  *
    '*          :                                                   *
    '****************************************************************
    ' Don't forget. The duty cycle is 0 to 256 resolution
    MAINLOOP:
      HPWM 1,110,50     ' Neutral discovered by experiment.
      PAUSE 5000
      HPWM 1,64,50      ' Full backwards
      PAUSE 2000
      HPWM 1,110,50
      PAUSE 5000
      HPWM 1,164,50     ' Full forward
      PAUSE 2000
     goto mainloop

    Ken

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Kenjones1935 View Post
    ....I am concerned because page 87 of the PBP Manual seems to say that the slowest pulse frequency is 245 hz. I want 50 hz.
    Period = [(PR2) + 1] * 4 * TOSC *(TMR2 Prescale Value)
    Frequency = 1/Period

    Therefore with a 4MHz clock, the lowest frequency is 244Hz.

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


    Did you find this post helpful? Yes | No

    Default I a not happy

    I think I am being told that HPWM can not do the job that I need done. Who has a suggestion?

  4. #4
    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 think I am being told that HPWM can not do the job that I need done. Who has a suggestion?
    Did you just open the floor to my broken record again?! Here is my view, but I agree, you (we all) need to hear more viewpoints than mine.

    Darrel Taylor Interrupts using TMR0 for pulse width, and TMR2 for 20ms period, and receiver pulse width sensing with CCP1_INT and TMR1. Your chip has them, just need to utilize them.

    If you always have an RC receiver on, then you can use that as your time base for 20ms. So, you could use the CCP1_INT to read the pulse width coming from the receiver. (This will use TMR1). Then you could use TMR0, or TMR2 for the pulse width. Every time you calculated the pulse from your CCP1_INT, you would send out your servo pulse on whatever pin you like, or control multiple pins, using the same timer.

    You really just need to start playing around with these timers and interrupts, and pulse some pins to get your head around it. But without a scope, it will be pretty difficult in my opinion.

    Here some scope info that you asked me about. It is a stand alone, but has a USB port and free software that comes with it. It cost just under $300.00. http://picbasic.co.uk/forum/showthread.php?t=12483
    Last edited by ScaleRobotics; - 27th January 2010 at 21:45.

  5. #5
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Ken,

    Can you do a LED blinky without using PAUSE (or any other delay commands)? Try to do a 1 second blinky using a timer. When you can do that, you will be well on your way to solving your motor ESC problem.

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


    Did you find this post helpful? Yes | No

    Default I need documentation

    Guys and maybe Gals,

    I am getting frustrated. I can not find the documentation that I need. I need Assembler Language details for the 16-bit chips. I need 16-bit BASIC libraries (Microchip talks C, not Basic). Darrel Taylor is rebuilding his site. He is not accepting new members.

    Microchip has screwed up on this link:

    MPLAB Assembler, Linker and Utilities for 16-Bit Devices User's Guide
    which points to-->
    http://ww1.microchip.com/downloads/e...Doc/51317G.pdf

    But when you download51317G you discover it is about the 24-BIt devices. It is the same document that -->

    DS51317 - MPLAB Assembler, Linker and Utilities for PIC24 MCUs and dsPIC DSCs User's Guide

    points to.

    What is the number for the 16-Bit devices user's guide?? I have not found a complete list of Assembly language code, syntax, structure whatever! Without that I do not see how I can understand what this 16F887 is doing.

    Also it is late. I am going to bed.

    Ken

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


    Did you find this post helpful? Yes | No

    Default

    Ken,

    Darrel's site must have been down for what evere reason. It seems to work now.
    http://www.PBPgroup.com/

    ASM instuctions are normally in the devices data sheet. But... Please do not take this the wrong way. If you are having trouble with Basic I doubt it ASM will do much good.

    I like remto's sugesstion about blinky. Give that a shot.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Firstly, your PIC16F887 is a 14-bit core device and the ASM manual is here MPASM™ Assembler, MPLINK™ Object
    Linker MPLIB™ Object Librarian User’s Guide


    Next thing you really need to download is the data sheet PIC16F887

    Also, download this FREE book and read it to understand how a PIC works PIC Microcontrollers

    The last one is the most useful - I pointed this out to you in an earlier post.

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 : 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