Rescaling of values in PBP.


Closed Thread
Results 1 to 8 of 8

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Oh craps, everyone's beaten me to it... my offering...

    OutputByte=(InputByte-165)*318/100

    This is calculated from...

    245-165=80 (the original span)

    254/80=3.175 (new span divided by old span)

    3.175 is rounded up to 3.18 and then we multiply it by 100 so as to keep everything an integer (which is why we finally do a divide by 100 to bring us back to reality).

    You may want to preceed the formula with...

    If InputByte<165 then InputByte=165
    If InputByte>245 then InputByte=245

    OMG Darrel... How much have you had to drink to think of that one?

  2. #2
    Join Date
    Sep 2008
    Location
    Stockholm
    Posts
    80


    Did you find this post helpful? Yes | No

    Default

    I guess that this was more complicated than I first guessed

    ..Currently I'm building a better test-rig so I can do some serious testing, right now I guess I just put a LCD in it and display the values.

    The 165 and 245 was just typical values, I guess that the low value can be around 135-170 and the high one maybe 235-254. Maybe the span can be even larger.

    The idea is to have a calibrating sequence first when the pic is started, where I determine the max and min value for this time, and then use this until the next start, where its calibrated again.'

    Darrels solution was very neat btw
    Last edited by Glenn; - 27th December 2008 at 23:01.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    OMG Darrel... How much have you had to drink to think of that one?
    Ha! Apparently not enough Eggnog yet. It worked on the first compile.
    Of course, I did an Ugly spreadsheet for the math first.
    <br>
    DT

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  3. Funny PULSIN values: what is going on???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th April 2008, 08:02
  4. 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
  5. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30

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