Displaying a decimal larger than 255 on LCD?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by timmers View Post
    Could it not be as simple as:-

    COUNTER VAR WORD
    COUNTER_H VAR COUNTER.BYTE1 'high byte
    COUNTER_L VAR COUNTER.BYTE0 'low byte

    LCDOUT $FE,128,DEC4 COUNTER 'top row, position 1.

    Tim.
    I don't think so, because although the LCDOUT is very simple and elegant, the maximum number which can be stored in either Counter_H or Counter_L is 255. Therefore the largest value which the word sized variable Counter can be is 255255.

    There needs to be a conversion first. The high byte needs to be multiplied by 256 (not 255 as I originally pointed out) and then added to the low byte before it gets stored in the word 'Counter'

  2. #2
    timmers's Avatar
    timmers Guest


    Did you find this post helpful? Yes | No

    Default

    Indeed you are right.

    Without knowing the exact task, I just wanted to keep it simple...

  3. #3
    Join Date
    Oct 2008
    Posts
    6


    Did you find this post helpful? Yes | No

    Default

    I need to be able to count to around 2000 without rolling over so 2 bytes would be plenty. I tried the code you posted.. but it still rolled over at 255. hmmm....

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by djmachine View Post
    I need to be able to count to around 2000 without rolling over so 2 bytes would be plenty. I tried the code you posted.. but it still rolled over at 255. hmmm....
    It still rolls at 255 ? Did yoiu declare the destination variable as a word or a byte ?

    Ever count of 1 of the lower byte equates to 1 in the destination variable, and every count of 1 in the high byte equates to 256 in the destination variable.

    2000, in this scheme, consists of highbyte = 7, low byte = 208

    As you can see, you need to multiply whatever is in the highbyte by 256. In this case 256*7 = 1792. Then add the lowbyte directly, and 1792 + 208 = 2000

Similar Threads

  1. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  2. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  3. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30
  4. 32 bit data displaying on LCD
    By selahattin in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 15th September 2006, 13:33
  5. 32 Bit Decimal Displaying On LCD
    By selahattin in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th January 2004, 19:24

Members who have read this thread : 0

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