Need help with scaling


Closed Thread
Results 1 to 12 of 12

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Take your 0-255 unit

    Multiply by 1412 into a Dummy Variable

    Then use DIV32 to divide by 10

    example...

    255 x 1412 / 10 = 36006

    If you multiplied by 14118 and divided by 100 you would be more accurate yealding...

    255 x 14118 / 100 = 36000

    Either results gives you two decimnal places (remember we're playing integers here, so the two decimal places are the rightmost two characters of the result.

    That won't be minutes though... it'll be DECIMAL degrees... you'll have to do some more math to calculate that into minutes.

    You have a POT that rotates exactly 360 degrees?

  2. #2
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    No, the pot has no detents or stops. It will rotate freely from 0 to 360 and back to 0. It's needed for my application to reduce the chance of damage if someone were to try and just spin the pot. Thanks a lot for your help with a rather elementry question.

  3. #3
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    ok, how about this. Now that I have gotten into degrees, I have fractions of degrees that I can show on the LCD by outputing the 1 and 0 bit of the degree measurement. In order to convert these two bits into minutes, I have to be able to combine the 1 and 0 bits as one integer and multiply by 60. Again, this has probably already been mentioned before but I still can't find it in the search function. Thanks.

    P.S.
    I know this is a beginner's question, but I will bet that you all were beginners at one point as well so take it easy on me please. thanks!!!

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by champion
    P.S.
    I know this is a beginner's question, but I will bet that you all were beginners at one point as well so take it easy on me please. thanks!!!



    I knew PBP when I was born



    ------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer
    I knew PBP when I was born



    ------------------------
    Me too, I just forgot it while I was in college

  6. #6
    Join Date
    Nov 2006
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    I guess what I'm asking is how to take the 0 and 1 bit from one number and put them into a seperate number so that I can further scale just those two bits. Thanks!!!

  7. #7
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by champion
    I guess what I'm asking is how to take the 0 and 1 bit from one number and put them into a seperate number so that I can further scale just those two bits. Thanks!!!
    This will give you a value with just the first two bits of the original byte:

    TwoBits = OrigByte & %00000011

    HTH,
    Steve

Similar Threads

  1. Scaling ADC values
    By purkolator in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th November 2007, 05:14
  2. Help scaling voltage...
    By sirvo in forum Schematics
    Replies: 6
    Last Post: - 30th July 2007, 19:35
  3. 16F876 ADC problem
    By Douwe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th June 2006, 19:38
  4. 2 Decimal Numbers
    By fowardbias in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th May 2006, 06:51

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