LCD and "count": need to clear LCD?


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Location
    Germany: Coal Area
    Posts
    6

    Default LCD and "count": need to clear LCD?

    Hi You all!

    had a VERY small program using "count" and "LCDout" . Problem occurs at the display:
    Every time the value displayed on the LCD goes down from two digits to one or from three to two it keeps the first number which isnīt cleared.
    Going up works fine because it overwrites every digit, but going down keeps some old ones.
    So I put in the "Clear Display" command into the loop but that makes the whole display flashing...otherwise the frequency counter works fine for me.

    How can I clear the numbers of my value on the display without flashing the whole thing?

    '
    ' DEFINITIONS
    '
    Cnt VAR Word ' Cnt is a word variable
    '
    ' START OF MAIN PROGRAM
    '
    CMCON = 7 ' RA0-RA3 are digital I/O
    TRISA = 0 ' PORT A is output
    TRISB = 1 ' PORT B0 is input others output

    PAUSE 500 ' Wait 0.5 second to initialize LCD
    Cnt = 0 ' Clear Cnt to zero
    LCDOUT $FE,1 ' Clear LCD
    LCDOUT $FE,2
    RPT:
    cnt = 0
    LCDOUT $FE,1 ' here is my problem!! makes everything flashing!'

    LCDOUT $FE,2

    Count PORTB.0,1000,CNT
    LCDOUT "Freq.= ",$FE,$C0,DEC Cnt ' Display count
    PAUSE 1000

    Goto RPT




    END

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    If I understood what you wanted to do, this should be it.


    Code:
    RPT:
        Count PORTB.0,1000,CNT
        LCDOUT $fe,1, "Freq.= ", DEC Cnt ' Display count
    Goto RPT

    Also, no need for PAUSE 1000 because your Count command itself creates 1000ms delay for LCD.


    --------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Try somethinbg like this:
    Code:
    LCDOUT "Freq.= ",$FE,$C0,DEC Cnt ' Display count
    If Cnt < 100 then LCDOUT " "      ' if Cnt is less than 100 then print a blank
    If Cnt < 10 then LCDOUT " "       ' if Cnt is less than 10 then print a blank 
    PAUSE 1000
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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


    Did you find this post helpful? Yes | No

    Wink The clear pencil

    Quote Originally Posted by Mugel
    Hi You all!

    How can I clear the numbers of my value on the display without flashing the whole thing?

    END
    Hi,

    Just print blank characters ( or new characters) UPON the existing you want to clear ...

    see manual page 94, middle ...

    LCDOUT $FE, $80 ( or $C0 ) + 6 ( or 7 i.e. ! ) , "___" ( 3 blanks or 888 i.e. )

    $FE,$80 + 6 sets the cursor position ... to the 6th position, line 1
    $FE,$C0 + 8 ................................... to the 8th position, line 2
    ...
    ...

    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
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Nice example Alain.

    Also, DEC modifier can be useful, too. Like DEC3 CNT or DEC4 CNT etc...
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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