LCD display not working properly


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Nov 2007
    Posts
    5

    Question LCD display not working properly

    I am trying to write a simple code to enable password entry. I am using 16F877a and two line LCD module for display. I have written following code which gets compiled successfully however when I key in four digits they are not displayed on the LCD module.

    OPTION_REG.7 = 0 ' PORTB Pullups.
    TrisA = 0 ' PORTA, all outputs
    PortA = 16 ' Turn off Buzer
    TrisB = %11110000 ' PORTB.0-3 outputs, 4-7 inputs
    PortB = 0
    Define LCD_DREG PORTC
    Define LCD_DBIT 0
    Define LCD_RSREG PORTC
    Define LCD_RSBIT 4
    Define LCD_EREG PORTC
    Define LCD_EBIT 5

    LD1 var PortA.2
    RL1 var PortA.3
    BUZ var portA.4
    cnt var byte
    cnt2 var word

    key var byte
    col var byte
    row var byte
    keycnt var byte
    pwOK var bit

    keybuf var byte[15]
    pwbuf var byte[4]
    Pause 100 ' Wait for LCD to start

    Lcdout $fe, 1, " HELLO " ' Display sign on message
    Lcdout $fe, 1, " WORLD " ' Display sign on message

    Pause 500 ' Wait for LCD to start

    Lcdout $fe, 1, "Enter pasaward " ' Display sign on message

    loop: Gosub Chk_KEYPAD: ' Get a key from the keypad
    Lcdout $fe, $c0+1,1,$0f, #key ' Display ASCII key number
    Gosub Chk_KEYPAD: ' Get a key from the keypad
    Lcdout $fe, $c0+2,1,$0f, #key ' Display ASCII key number
    Gosub Chk_KEYPAD: ' Get a key from the keypad
    Lcdout $fe, $c0+3,1,$0f, #key ' Display ASCII key number
    Gosub Chk_KEYPAD: ' Get a key from the keypad
    Lcdout $fe, $c0+4,1,$0f, #key ' Display ASCII key number

    Goto loop ' Do it forever
    Last edited by dilpkan; - 22nd January 2008 at 03:02. Reason: slight change

  2. #2
    Join Date
    Jun 2006
    Location
    Mountain View California
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    I didn't see a Chk_KEYPAD subroutine included in your code. Do you have one?

  3. #3
    Join Date
    Jan 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    If this is for password entry, do you even WANT to display the characters that are entered? Better to handle it like MS Windows and display asterisks.

    Just a thought,
    ... Steve.

  4. #4
    Join Date
    Nov 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by bbazor View Post
    I didn't see a Chk_KEYPAD subroutine included in your code. Do you have one?

    Chk_KEYPAD subroutine has been used at gosub

    The problem is that the four numbers are not displayed at 1st , 2nd , 3rd ,4th positions in one line

    thanks for replying

    dilpkan

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dilpkan View Post
    Chk_KEYPAD subroutine has been used at gosub
    The problem is that the four numbers are not displayed at 1st , 2nd , 3rd ,4th positions in one line
    thanks for replying
    dilpkan
    Let's analyze one of your LCDOUT statements...

    Quote Originally Posted by dilpkan View Post
    Lcdout $fe, $c0+1,1,$0f, #key
    LCDOUT - the command
    $fe - send an instruction
    $c0 + 1 - the position
    1 - clear the display which basically resets the display back to square one
    $0f - programmable character
    #key - a variable
    ....
    See a problem here?

  6. #6
    Join Date
    Nov 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by scarroll01 View Post
    If this is for password entry, do you even WANT to display the characters that are entered? Better to handle it like MS Windows and display asterisks.

    Just a thought,
    ... Steve.

    Thanks for replying

    I accept your suggestion ! however how to get the four asterisks in four positions in one line

    Please suggest

    dilpkan

  7. #7
    Join Date
    Nov 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by skimask View Post
    Let's analyze one of your LCDOUT statements...



    LCDOUT - the command
    $fe - send an instruction
    $c0 + 1 - the position
    1 - clear the display which basically resets the display back to square one
    $0f - programmable character
    #key - a variable
    ....
    See a problem here?

    I deleted "1 " -(clear the display...) and tried the above code using gosub four times for the four diff. positions but the display shows a question mark at 16th position on first line and stops. why?

    please help.

    dilpkan

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dilpkan View Post
    I deleted "1 " -(clear the display...) and tried the above code using gosub four times for the four diff. positions but the display shows a question mark at 16th position on first line and stops. why?

    please help.

    dilpkan
    Increase the startup pause to 1 second...increase your LCD_commandus and LCD_dataus to higher values, try it again and see what happens.

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    NOPE,

    if you use 1 without $FE before, it will try to print ASCII decimal character 1, same for $0F. If you want to mask you data with asterix, just use "*" in your lcdout and forget the #key.
    MAybe you could find some tips in the following
    http://www.picbasic.co.uk/forum/show...mbination+gate
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    NOPE,

    if you use 1 without $FE before, it will try to print ASCII decimal character 1, same for $0F. If you want to mask you data with asterix, just use "*" in your lcdout and forget the #key.
    MAybe you could find some tips in the following
    http://www.picbasic.co.uk/forum/show...mbination+gate
    Are you saying that:
    LCDOUT $fe , 1 , $80 , "HELLO"
    is different from:
    LCDOUT $fe , 1 , $fe , $80 , "HELLO" ???

    I guess I just never noticed, or tried it.

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yup.. try it.. or read through the macros
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    Join Date
    Jan 2008
    Location
    Finland
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    . .
    Last edited by mara; - 24th January 2008 at 21:08. Reason: uups, wrong thread

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    ... me too
    Last edited by mister_e; - 24th January 2008 at 21:12. Reason: see previous reason
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Yup.. try it.. or read through the macros
    Well I'll be...(head shaking)... never noticed before...

  15. #15
    Join Date
    Nov 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Question keypad.bas does not compile in pbp

    Quote Originally Posted by mister_e View Post
    NOPE,

    if you use 1 without $FE before, it will try to print ASCII decimal character 1, same for $0F. If you want to mask you data with asterix, just use "*" in your lcdout and forget the #key.
    MAybe you could find some tips in the following
    http://www.picbasic.co.uk/forum/show...mbination+gate
    1)I tried to include Keypad.bas and tried to compile however it throws an error for the first line i.e. keypad routine as syntax error. If I remove it throws too many errors! in assembler. Is it not necessary to compile. If I don't compile and compile only gate code it says unable to open keypad.bas


    @ if HIGH_SECURITY == 1
    LCDOUT $FE, $C4 + ComboPtr, "*" ; print a Mask character
    if Key = "*" then Reset
    if Key = "#" then Finish
    @ endif

    The compiler also shows errors for
    if Key = "*" then Reset
    if Key = "#" then Finish

    I tried using diff. combination but to no better effect. Can some one help?

    Thank you in advance,
    Regards
    dilpkan

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. LCD Display
    By lambert in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th January 2010, 22:18
  3. Simple LCD code not working!...WHY?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th November 2009, 19:48
  4. My LCD code is not working...
    By kvrajasekar in forum mel PIC BASIC
    Replies: 2
    Last Post: - 7th December 2008, 05:41
  5. LCD Display not working - PIC heating...
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 24th September 2006, 07:35

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