4x3 keypad and an LCD.. need help.


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit
    You could have

    Code:
    y=26
    x = (1000*y/21)//1000
    The above will only work if "y" is an integer 22 through 41.
    I'm not sure why any value 0 - 65 will not satisfy your equation. The only requirement to keep it "legal" is to keep 1000*y under 65535. Also if you can afford to loose one digit after the decimal point (0.00x) then the range for y will be 0 – 650.
    I guess knowing more about the application will help make the best decision.

    Regards,

    Nick

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Nicmus View Post
    I'm not sure why any value 0 - 65 will not satisfy your equation. The only requirement to keep it "legal" is to keep 1000*y under 65535. Also if you can afford to loose one digit after the decimal point (0.00x) then the range for y will be 0 – 650.
    I guess knowing more about the application will help make the best decision.

    Regards,

    Nick
    I should have said 2 - 41 .
    Beyond these values you run into the leading zero problem with the equation I gave.
    Some values above 41 will work, some will return 0.0xx. The 0 tenths is the problem.
    Thanks for catching that.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, Taisen

    Is this little calculator to count what you'll get this year ???

    http://www.piratekingonline.com/foru...earchid=836105

    Seriously ... you should turn to a 16Bits core device ( 18F452 i.e.) and use the 32 bits calculations of PBPL ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Hi mackrackit,

    If the leading zeros are a problem you just use DEC 3 in your LCDOUT command and you should be OK on full 0 – 65 range. The only change will be with the result of y/21 (0 -6).

    Regards,

    nick

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Nicmus View Post
    Hi mackrackit,

    If the leading zeros are a problem you just use DEC 3 in your LCDOUT command and you should be OK on full 0 – 65 range. The only change will be with the result of y/21 (0 -6).

    Regards,

    nick
    Yep. We really need to know what taisen83 is trying to do.
    If all of the sudden the numbers change to something like
    x = (1000*1/3000)//1000
    Then it all falls apart, I tink

    PBL is the ticket.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Dec 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    currently im doing a rice dispenser device that accepts a weight or price value.. my problem was at the price input value.. as the device runs it will ask for a price/kilo of the rice.. assuming i input a value of 25.50, but the actual value stored is 2550. this 2550 is the reference for determining the weight to be dispensed. after 2550 stored, the program ask for another input to be compared in the 2550. i used the codes that mackrackit posted.

    'variable PRICE is the reference input
    'TOTALAMOUNT is the variable to be compared

    PRICED = PRICE/10
    AMT = TOTALAMOUNT/10
    DECIKILO = (100*AMT/PRICED)//100
    WHOLEKILO = (100*AMT/PRICED)/100

    LCDOUT $FE,$C0,#WHOLEKILO,".",#DECIKILO," Kg"

    using this the program I can determine the weight but it only accepts 4 digit number.. making it to a 5 digit input will go beyond a 65535 limit.

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


    Did you find this post helpful? Yes | No

    Default

    If you have PBP 2.50 and use a 18F
    chip, you can compile with PBPL
    that will give you 32 bit math.
    This will give you the ability to use
    numbers with a range of
    -2147483648 to
    +2147483647
    That should solve the problem.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Dec 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    the codes that i created in 16f877 can be used when i changed to 18f, what 18f pic is almost the same as 16f877? and it must be pbp 2.50? coz im currently using 2.47 only.. thnx
    Last edited by taisen83; - 5th January 2009 at 03:39.

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