LCDOUT -- lose the zero ?


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default LCDOUT -- lose the zero ?

    Can't figure out how to do this --

    mynumber = byte
    mynumber = 120


    LCDOUT $FE,1,DEC mynumber

    also tried --

    LCDOUT $FE,1,#mynumber

    Problem is that whenever I lower the number below 100 (I have 2 switches set up - and +), the LCD
    will read 990 980 etc instead of 99, 98.

    It's fine from 100 to 255.

    Also, if I start mynumber with a value of say 90, if I remember right, it's ok UNTIL I move it past 100. Then when I try and lower it, it goes back to adding the zero 990, 980 etc.

    I don't use pbp much anymore so I'm sure it's something simple. Thanks kindly for any help.

  2. #2
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT -- lose the zero ?

    Try this LCDOUT $FE,1,#mynumber," "
    $FE,1 should clear display. But for some reason your display isn't cleared.

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT -- lose the zero ?

    I use the following code to display a word variable which contains the value between 0 and 100

    Code:
    If maxbright  = 100 then
    LCDOut $FE,$c0,#maxbright,"%"
    endif
    
    If maxbright  =0 or maxbright <10 then
    LCDOut $FE,$c0,dec1 maxbright,"% "
    endif
    
    if maxbright >=10 and maxbright <100 then
    LCDOut $FE,$c0,dec2 maxbright,"%   "
    endif
    Just change maxbright for your variable and you should be fine
    Last edited by Scampy; - 11th July 2017 at 10:14.

  4. #4
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT -- lose the zero ?

    I don't have problem with leading zeros, so I just use DEC3 to make it simple.

  5. #5
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT -- lose the zero ?

    I resorted to a longer method of writing to an LCD. To get numeric values to print, first I create variables for each digit.

    Code:
    Val VAR BYTE
    ValA VAR BYTE[3]  'Occupies 3 consecutive addresses
    
    ARRAYWRITE ValA, [#Val]
    
    IF Val < 100 then
      ValA[2] = ValA[1]
      ValA[1] = ValA[0]
      ValA[0] = " "
    I then print individual characters to the LCD.

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT -- lose the zero ?

    Ok. I get it now. Never really used LCDOUT or an LCD for that matter. Wasn't clearing the display, thinking I could just manipulate line 2 leaving line 1 intact. Silly me. --- thanks

Similar Threads

  1. LCdout
    By lerameur in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd December 2006, 17:14
  2. 8bit LCDout vs 4bit LCDout
    By keithdoxey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th May 2006, 13:16
  3. Lcdout
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th February 2006, 02:39
  4. LCDOUT help
    By f6ggy in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th October 2003, 13:51

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