two variables on LCD


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    This is adapted from the thread ...

    32-bit Variables and DIV32, Hourmeter 99999.9
    http://www.picbasic.co.uk/forum/showthread.php?t=1942

    Should work, but I haven't tested the modification.
    Code:
    BigVar    VAR WORD[2]    ; 32-bit (Dword)
      Var1    VAR BigVar(1)
      Var2    Var BigVar(0)
    
    Result    Var Word
    Remainder Var Word
    
    ;----[Load a 32-bit (Dword) variable into PBP registers, Prior to DIV32]-----
    Asm
    PutMulResult?D macro Din
        MOVE?BB   Din, R2
        MOVE?BB   Din + 1 , R2 + 1
        MOVE?BB   Din + 2, R0
        MOVE?BB   Din + 3, R0 + 1
        RST?RP
      endm
    EndAsm
    
    ;====[Simple loop to test Big Numbers]=======================================
    Start:
        Var1 = 1
        Var2 = %1111101111010000
    
    MainLoop:
        LCDOUT $FE,1        ; clear screen
        Gosub ShowBigNumber
        PAUSE 1000
        Var2 = Var2 + 1
        if Var2 = 0 then Var1 = Var1 + 1
    goto MainLoop    
    ;===========================================================
    
    
    ;----[Display 32-bit value with 2 decimals using LCDOUT]---------------------
    ShowBigNumber:
    @   PutMulResult?D  _BigVar
        Result = DIV32 1000
        Remainder = R2
        LCDOUT $FE, 2            ; Home Cursor
        IF Result > 0 then
            LCDOUT Dec Result, DEC1 Remainder/100,".",DEC2 Remainder//100
        else
            LCDOUT DEC Remainder/100,".",DEC2 Remainder//100
        endif   
    return
    HTH,
     DT

  2. #2
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Smile

    Thank you Darrel.
    It's work fine.
    Only i put out the two lines
    Var2 = Var2 + 1
    if Var2 = 0 then Var1 = Var1 + 1

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik View Post
    Only i put out the two lines
    Var2 = Var2 + 1
    if Var2 = 0 then Var1 = Var1 + 1
    Exactly what you should have done.

    Thanks for the update.

    DT

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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