4x3 keypad and an LCD.. need help.


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Posts
    9

    Default 4x3 keypad and an LCD.. need help.

    hello everyone! I'm new in this forum. Anyone can help me with my project? Im using a PIC16F877 and i want to know what codes are needed in PICBasic Pro to display the number key pressed in the 16x2 LCD Hitachi HD44780 and the total number that was entered will be stored in a variable for later use in the program.. pls help me.. thnx to all who can help..

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


    Did you find this post helpful? Yes | No

    Default

    Welcome to the forum.

    First let me ask how far you are in this adventure.

    Have you got an LCD to work yet? If so then these will help with the key-pad.
    http://www.picbasic.co.uk/forum/showthread.php?t=3250
    http://www.picbasic.co.uk/forum/showthread.php?t=10110
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    To repeat Mackrackit's admonition: Welcome to the forum. Now, look at the home page, scroll down to code examples, open it up and you will find at least 2 usable examples there.
    Last edited by Archangel; - 23rd December 2008 at 17:25.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Wink

    Welcome here,Taisen

    Also think to browse the PARALLAX site ... ( ~ same basic )

    your app reminds me something seen there ...

    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 " !!!
    *****************************************

  5. #5
    Join Date
    Dec 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thank you sir mack, joe and ace.. i'll try to study what you have told me. can i ask 1 more thing? u know how to translate this equation into picbasic pro codes: x = 2 * 1.5.. i tried to do this but the result was x = 2 only.. it means only the equation x = 2 * 1 was seen by the program.. anyone can help.. thnx!

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


    Did you find this post helpful? Yes | No

    Default

    If you must have floating points there is a routine over at the MeLabs site.

    The easy way for what you are doing is to drop the decimal point.
    x = 2 * 1.5

    would be
    x = 2 * 15 / 10

    Then if you are wanting to display a 3.0
    Code:
    LCDOUT, $FE;1,DEC x,".",DEC2 x//100
    65535 is the largest value for a WORD size variable. So 125000 over flows, comes back around starting at zero and the result is 59464.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Dec 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    i tried the codes but the lcd displaying 3.03.

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


    Did you find this post helpful? Yes | No

    Default

    OOPPS, I was not thinking straight

    What we are doing.
    Take the number with one decimal place and multiply by 10 before the PIC sees it.
    1.5 is now 15
    1.6 is now 16
    ...
    Code:
    x = 2 * 16
    lcdout $FE,1,DEC x / 10,".",DEC x//10
    In the above the "x / 10" will return 3.
    x//10 will return the remainder 2.

    Look in the Pic Basic manual under Math Operators for more fun/confusing stuff
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Dec 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thanks! that info really helps me..
    But i still got another problem. if the equation goes like this x = 26 // 21.. the answer should be 238095238, the decimal part cannot read by the program and the answer is wrong because the limit is 65535 right? how to get the right answer like display 238 only? thanks again..

  10. #10
    Join Date
    Dec 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    also when the equation is x = 50 x 2500.. x becomes 59464 instead of 125000.. anyone know why this happen?

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