PBP projects for R/C models


Results 1 to 40 of 772

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    Since it doesn't have to be exact, you could simplify your code.

    Instead of:
    Code:
    Checkpot:
    adcin PORTA.0, Potread
    write 4, word Potread
    select case Potread
    case Potread < 36
    Forward = 112
    case Potread => 36 and Potread < 73
    Forward = 113
    case Potread => 73 and Potread < 109 
    Forward = 114
    case Potread =>109 and Potread < 146 
    Forward = 115
    case Potread => 146 and Potread < 182 
    Forward = 116
    case Potread => 182 and Potread < 219
    Forward = 117
    case Potread => 219
    Forward = 118
    end select
    write 2, word Forward
    something like:
    8 bit ADC:
    Code:
    Checkpot:
    adcin PORTA.0, Potread
    Potread = Potread/37
    Forward = Potread+112
    10 bit ADC:
    Code:
    Checkpot:
    adcin PORTA.0, Potread
    Forward = Potread/147 + 112
    Last edited by ScaleRobotics; - 2nd September 2010 at 16:15.
    http://www.scalerobotics.com

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