Menu

16F877a, LCD and Keypad = garbaged characters

Help
vmatthews
2014-01-21
2014-01-24
  • vmatthews

    vmatthews - 2014-01-21

    Who is up for a challenge?
    Actually, it will probably be easy for those who have travel this path before.
    But after a few days with it, I am stumped.
    The LCD display the "Pre-Stage" msg OK. so it is good.
    but I get grabled characters on the LCD contantly.
    Checked with a DMM and a LED that the Cols & Rows are correct and
    All Keypad strokes are functioning, replaced the Keypad and no better.
    I am picking up garbage characters and the LEDstat and 'TempX" show
    the code is running thru the loop.
    The LEDstat is flickering as IF a key was press, and mostly garbage.
    Sometimes when I power it up again I get a '13' running on the LCD.
    even tho no key is press, even with the Keypad removed. so something
    is leaking in. I am pulling the rows LOW with a 10k and changed ports,
    (A to C now D), added .01uf cap. removed LCD and still getting traffic on the LEDstat.
    This is on a Breadboard. tried it with the Pickit3 in and out of circuit.
    The Power supply is my full wave bridge rectifier, filtered with 2200uf
    to a 7805, with a .01uf cap to clean up output noise.
    Exits thru pins directly to my breadboard. Jumpers are not longer then 6"
    added some code to help me diagnose it.
    thus the weird code at times, which helps narrow it down.
    Any clue(s) ??
    Thanks..
    Will try and upload a schematic...
    odd, attachment feature shows up if I go to 'reply'. but not new topic?!?


    \~~~~
    ;Chip Settings
    #chip 16F877A,8

    ;Defines (Constants)
    #define LCD_IO 4
    ' my EVbeasy development board grounds the RW
    #define LCD_NO_RW 'Thanks to whoever posted this before!
    #define LCD_RS PORTB.1
    #define LCD_Enable PORTB.0
    #define LCD_DB4 PORTB.2
    #define LCD_DB5 PORTB.3
    #define LCD_DB6 PORTB.4
    #define LCD_DB7 PORTB.5

    #define KeypadPort PORTD
    #define LEDStat PortC.3

    dir LEDStat out
    set LEDStat On
    cls
    Print "Pre-Stage " 'prove LCD is functioning- yep!
    wait 1 s
    Set LEDStat off
    cls
    Tempx=1 ' a varible that shows in LCD '0' then '1' to show looping
    wait 100 mS

    'Main loop
    Do Forever
    'Get key
    Temp = KeypadData
    'if a key is pressed, then display it
    IF Temp=255 Then GOTO JMP2
    CLS
    Print "Reading: " '
    LCDInt Temp 'the keypad value
    PRINT "_" ' a space holder
    LCDINT TEMPX ' osc between 0 & 1 to show looping
    set LEDStat on 'high when keypad used
    Wait 100 ms
    IF TEMPX=1 THEN
    TEMPX=0
    GOTO jmp2
    END IF
    iF TEMPX=0 THEN TEMPX=1 'alternate values to show looping

    jmp2:
    set LEDStat off 'turn off visual key press indicator
    wait 100 ms
    loop
    \~~~~

     
  • vmatthews

    vmatthews - 2014-01-21

    the attachment is 2 messages below..
    Thanks guys for all your support to the users...
    I've spent the better side of two days just reading all the help msgs.
    My wife thought I was in a coma since she didn't see any different web sites flash by the monitor..
    Good Questions, Great answers, outstanding support !!

     

    Last edit: vmatthews 2014-01-21
  • Chuck Hellebuyck

    I suspect it's not reading the keypad correctly because you don't have the column pins pulled up to Vdd.
    They are floating. Though I'm not sure why you wouldn't see that on the LCD.

     
    • vmatthews

      vmatthews - 2014-01-21

      A good eye noticing the pull ups, that would be my bad, as I looked at the
      schematic and indeed they are not on it, but, yes they are on the Breadboard..
      I'll upload the revision.

      Thank you..
      vm

       
      • vmatthews

        vmatthews - 2014-01-24

        WELL after moving the project to a different breadboard I used 1k resistors
        instead of the 10k resistors I was using before, and lo' it now works..
        I'll try it with 4.7k to lower the 5ma draw that calculates at 1k to only 1ma
        with the 4.7ks. The current keypad looks like the attachment. Is there any internal resistors that might have been the problem with my use of 10ks also?
        I asked cause I've seen other schematics that show the keypads with 10ks?
        I didn't seem to detect a resistance with my ohm meter, just curious now.
        mmmeeeooowwwwww .. yea it will kill me....
        Thanks guys for your input !

        vic

         
        • vmatthews

          vmatthews - 2014-01-24

          well I just open one of these pads and see no resistors, in the board or matrix pcb, so that question is dead.

           
  • Marcoos

    Marcoos - 2014-01-21

    The 4 data lines of the LCD should be earthed via a resistor, I use 4.7 Kohm
    Ciao

     
    • vmatthews

      vmatthews - 2014-01-21

      Thanks, I try that..
      anyone else..

      I'll repost the msg I left earlier that may have been out of date for the
      contributing users...

      Thanks guys, for all your support to the users...
      I've spent the better side of two days just reading all the help msgs.
      My wife thought I was in a coma since she didn't see any different web sites flash by the monitor..
      Good Questions, Great answers, outstanding support !!
      -------------------

       
  • Chuck Hellebuyck

    I have sample code for driving an LCD and reading a keypad at my website.
    Maybe you could look them over for clues. I've tested them all and they work fine.
    I haven't added schematics for everything yet.
    http://www.greatcowbasic.com/sample-projects.html

     
    • vmatthews

      vmatthews - 2014-01-23

      Thanks Chuck;
      I'll check that out..
      I haven't found a solution yet, So I'll tear down the breadboard circuit and put
      it back together, maybe something will show-up, I'll try a different breadboard too,
      this one currently is 12+ years old and has seen tons of electronic experiments, may be a bad row or some contact not pinching anymore. I've got nothing to loose!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.