Display "0" on LCD


Closed Thread
Results 1 to 19 of 19
  1. #1
    ghoot's Avatar
    ghoot Guest

    Default Display "0" on LCD

    Hello,
    I have noticed that any number ending in zero "0" will not display on an LCD. I set up a loop something like this:

    FOR i=0 to 100
    LCDout #i
    Sleep 2
    next i

    and every time a number that ended in zero (0,10,20,30 etc.) was reached, the LCD was blank. Any ideas?

  2. #2


    Did you find this post helpful? Yes | No

    Default

    I would guess something in the lcd controller is defective. Have you tried another lcd?

  3. #3
    ghoot's Avatar
    ghoot Guest


    Did you find this post helpful? Yes | No

    Default

    Hi,
    The LCD is a 2x8 display. I've used 2 of the same brand "Crystalfontz", but haven't tried a different brand. Maybe that could be the problem. I hope not, cause I like the ones they have.

  4. #4
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Well, 4 years later and I'm not much smarter and I still have the same problem. :-) Since zero is considered a terminator for a string, I guess this has something to do with the issue? Is there some way to tell PBP to use some other character as the terminator? Really strange that no one else has this issue. The display is a crystalfontz CFAH0802A-YYH-JP. Any ideas would sure be apreciated.
    Gary
    Last edited by g-hoot; - 13th May 2008 at 21:07.

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by g-hoot View Post
    Well, 4 years later and I'm not much smarter and I still have the same problem. :-) Since zero is considered a terminator for a string, I guess this has something to do with the issue? Is there some way to tell PBP to use some other character as the terminator? Really strange that no one else has this issue. The display is a crystalfontz CFAH0802A-YYH-JP. Any ideas would sure be apreciated.
    Gart
    Try this:
    i var word
    FOR i=0 to 10000
    LCDout $fe, $80, DEC5 i
    next i

  6. #6
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Try this:
    i var word
    FOR i=0 to 10000
    LCDout $fe, $80, DEC5 i
    next i
    Thanks for the code. I gave it a try, but still no go, the LCD stills goes blank as soon as a number ending in zero is displayed. I'm guessing something to do with zero being a "terminator". Not real sure what that means. The LCDout command above uses a bunch of code. I have to delete a bunch of text out of other LCDout commands to get it to compile using:

    LCDout $fe, $80, DEC5 i

    instead of

    LCDout #i

    Gary

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    The LCDout command above uses a bunch of code. I have to delete a bunch of text out of other LCDout commands to get it to compile using:
    LCDout $fe, $80, DEC5 i
    instead of
    LCDout #i
    Gary
    Just use the code in the post above, and only that code, nothing else (except for maybe some initialization code)
    What else are you running, or trying to run at the same time?
    It sounds to me like you've got other things going that we're all not able to see for some reason or another. All this talk about a 'terminator' basically doesn't really apply. There is no real 'terminator' to speak of like a 'null' when using strings in VB or the like.
    What version of PBP are you using?

  8. #8
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Just use the code in the post above, and only that code, nothing else (except for maybe some initialization code)
    What else are you running, or trying to run at the same time?
    It sounds to me like you've got other things going that we're all not able to see for some reason or another. All this talk about a 'terminator' basically doesn't really apply. There is no real 'terminator' to speak of like a 'null' when using strings in VB or the like.
    What version of PBP are you using?
    OK, I did just the code below. I added the Pause 500 to see what it was doing, and still get a blank screen on each number ending in zero.

    LCDONOFF VAR PORTB.7
    High LCDONOFF

    i VAR WORD
    For i=0 TO 10000
    LCDOut $fe, $80, DEC5 i
    Pause 500
    Next i


    The reason that I got hung up on the terminator thing is becasue I am storing as much string data as I can in EEPROM, and then I loop through and do a READ 8 times (2x8 LCD) to get the string. Somehow, like magic :-), when it hits the zero on the strings that are less that 8 characters, it knows that's the end of the string. Here is part of how i have it layed out:

    EEPROM 36,["1",".","5"," ","S",0] '1.5 S
    EEPROM 42,["1","5"," ","S",0] '15 S
    EEPROM 47,["2","0"," ","S",0] '20 S
    EEPROM 52,["1"," ","M",0] '1 M
    EEPROM 56,["2"," ","M",0] '2 M
    EEPROM 60,["5"," ","M",0] '5 M
    EEPROM 64,["V","e","r","y","H","i","g","h"]
    EEPROM 72,["S","l","a","v","T","e","s","t"]


    <B>I use the melabs programmer version 3.31 (it also did this on an older version that I used to use). I write the code in CodeDesigner Lite and PBP is version 2.46a. Oh, and the chip is a 16F648A.</B>
    Thanks,
    Gary
    Last edited by g-hoot; - 14th May 2008 at 13:30.

  9. #9
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hi Gary,

    can you see the '0's preceeding the numbers you are displaying? i.e.

    00001
    00002
    00003
    .......
    0001 - where 0 is not shown as it's the end number
    00011
    00012

    Is this how it's displaying on your screen or is it more like:

    00008
    00009
    - where no numbers at all are displayed
    00011
    00012

    Cheers

    Rob

  10. #10
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Hello Rob,
    Yes I can see the leading zeros. It looks like the last way you show it, the screen is completely blank when it should display zero, or any number ending in zero. Since this apparently isn't a common problem, I'm guessing it has something to do with the combination of versions of compiler, PBP and/code designer light maybe? Or maybe a configuration setting? Another strange thing that may ring a bell for someone reading this is that I can't display the name "MCKELLOP". Screen goes blank on that too...

    00008
    00009
    BLANK SCREEN (if there is some other text on the other line of the LCD, it will disappear too).
    00011
    00012


    Thanks,
    Gary

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Show all your code... I get the feeling you don't have a pin set right, or maybe you've got your timing set too fast...

  12. #12
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Show all your code... I get the feeling you don't have a pin set right, or maybe you've got your timing set too fast...

    skimask,
    this is the entire code that reproduces the problem. I even deleted all of the defines...everything but this. Let me see what I need to do to show my configuration settings and I'll post them too.


    LCDONOFF VAR PORTB.7
    High LCDONOFF

    i VAR WORD
    For i=0 TO 10000
    LCDOut $fe, $80, DEC5 i
    Pause 500
    Next i

  13. #13
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Here's a pic of the config settings....
    Attached Images Attached Images  

  14. #14
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Then try this:
    Code:
    DEFINE LCDCOMMAND_US 5000
    DEFINE LCDDATA_US 255
    i var word : trisb.7 = 0 : portb.7 = 1
    pause 1000 : lcdout $fe , 1 : pause 1000
    for i = 0 to 10000 : lcdout $fe , $80 , DEC5 i : pause 500 :next i
    END
    EDIT: Just looked at your config settings. I've always found it helpful to have the powerup timer on, no matter what PIC I've used.
    And even though you aren't using it, turn off the watchdog timer.
    Last edited by skimask; - 15th May 2008 at 00:00.

  15. #15
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Then try this:
    Code:
    DEFINE LCDCOMMAND_US 5000
    DEFINE LCDDATA_US 255
    i var word : trisb.7 = 0 : portb.7 = 1
    pause 1000 : lcdout $fe , 1 : pause 1000
    for i = 0 to 10000 : lcdout $fe , $80 , DEC5 i : pause 500 :next i
    END
    EDIT: Just looked at your config settings. I've always found it helpful to have the powerup timer on, no matter what PIC I've used.
    And even though you aren't using it, turn off the watchdog timer.

    Still doing the same thing to me. I copied the exact code here and pasted it into an empty program. Tried with the old config settings, and the new one's suggested here. Very strange. Appreciate all of the ideas, so far, I just got a weird one here. Isn't there a file somehwre that has settings in it for different PIC's? Maybe I need to change something in that?


    Oh, here are the defines that I've been using in the full program:

    DEFINE LCD_DREG PORTA 'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT 0 'Define first pin of portb connected to LCD DB4POTSETTTT
    DEFINE LCD_RSREG PORTA 'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 4 'Define Portb pin used for RS connection
    DEFINE LCD_EREG PORTB 'Define PIC port used for E line of LCD
    DEFINE LCD_EBIT 3 'Define PortB pin used for E connection
    DEFINE LCD_BITS 4 'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2 'Define using a 2 line LCDRefTime
    DEFINE LCD_COMMANDUS 2500 'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 1200 'Define delay time between data sent.

    Gary

  16. #16
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    For one thing, the PBP manual doesn't say it specifically, but LCDDATA_US is a byte value. 1200 would actually be 176.
    Have you got a pullup on A.4?

    Try this then:
    Code:
    DEFINE LCD_DREG	PORTA	'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT	0		'Define first pin of portb connected to LCD DB4POTSETTTT
    DEFINE LCD_RSREG PORTA	'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 4		'Define Portb pin used for RS connection
    DEFINE LCD_EREG	PORTB	'Define PIC port used for E line of LCD
    DEFINE LCD_EBIT	3		'Define PortB pin used for E connection
    DEFINE LCD_BITS	4		'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2		'Define using a 2 line LCDRefTime
    DEFINE LCD_COMMANDUS 5000	'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 200	'Define delay time between data sent.
    i var word : trisb.7 = 0 : portb.7 = 1
    pause 1000 : lcdout $fe , 1 : pause 1000
    for i = "a" to "z" : lcdout $fe,$80,i,i+1,i+2,i+3,i+4,i+5,i+6,i+7
    pause 500 :next i
    END

  17. #17
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    For one thing, the PBP manual doesn't say it specifically, but LCDDATA_US is a byte value. 1200 would actually be 176.
    Have you got a pullup on A.4?

    Try this then:
    Code:
    DEFINE LCD_DREG	PORTA	'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT	0		'Define first pin of portb connected to LCD DB4POTSETTTT
    DEFINE LCD_RSREG PORTA	'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 4		'Define Portb pin used for RS connection
    DEFINE LCD_EREG	PORTB	'Define PIC port used for E line of LCD
    DEFINE LCD_EBIT	3		'Define PortB pin used for E connection
    DEFINE LCD_BITS	4		'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2		'Define using a 2 line LCDRefTime
    DEFINE LCD_COMMANDUS 5000	'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 200	'Define delay time between data sent.
    i var word : trisb.7 = 0 : portb.7 = 1
    pause 1000 : lcdout $fe , 1 : pause 1000
    for i = "a" to "z" : lcdout $fe,$80,i,i+1,i+2,i+3,i+4,i+5,i+6,i+7
    pause 500 :next i
    END


    SOLVED!
    It's a long story, and I'm a little embarrassed to admit it. I had issues every once in a while with strange characters displaying on the LCD. I sent one of my boards to the LCD company a few months ago and they found that I was running it slightly below the minimum voltage in the spec sheet. I had used the recommended resistor value to power, but also had something else running from the same pin which pulled the voltage something like .3 volts below spec. Replacing that resistor fixed the strange character issue. Well, when I started adding this counter to my code the other day, I grabbed one of my older boards and started testing and was having this "zero" problem.

    I just ran your code above and when "p" was the ending character, the LCD went blank. So i made a program to display a bunch of words, with some ending in "p"....went blank on every "p" ending word. In the process of testing, I broke a lead wire to the battery off for the board, and when I went out to solder in back on a few minutes ago, I noticed that this board hadn't had the resistor replaced, so I replaced it and THAT WAS THE PROBLEM!

    So, to make a long story short, the voltage for the LCd was too low.

    I sure thank you guys for your time and troubles! OK, now let the beatings begin....
    Gary
    Last edited by g-hoot; - 15th May 2008 at 01:27.

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


    Did you find this post helpful? Yes | No

    Default

    Maybe I have missed it, but I do not see where you have turned off the comparators.
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

  19. #19
    Join Date
    Dec 2005
    Posts
    46


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Maybe I have missed it, but I do not see where you have turned off the comparators.
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Thanks mackrackit, I will take a look at that. I did get the problem solved though, so I am very happy!
    Gary

Similar Threads

  1. LCD Display
    By lambert in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th January 2010, 22:18
  2. LCD display not working properly
    By dilpkan in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 2nd February 2008, 07:43
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. LCD Display not working - PIC heating...
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 24th September 2006, 07:35
  5. A/D display result on LCD
    By winsthon in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 10th January 2004, 10:09

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