DIG DEC Madness


Closed Thread
Results 1 to 2 of 2

Thread: DIG DEC Madness

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96

    Talking DIG DEC Madness

    All,
    I have been right justifying my output to the screenso that I will always have my least sig fig in position 6 on line 1 of the 2x8 lcd....
    My code works great EXCEPT for one little thing....if my value is..say 9, my output looks like..
    [ 0,009 f], the first 0 is gone (as it should be) but the rest of the zeros and "," apear when they should not (don't want em!). I do not want to clear the screen everytime I take a new value as this will make the screen blink, just want a clear steady view. I have only included the code that applys to my dillema. Surely this is a silly error I am just not seeing right now...any help would be great.

    Code:
     
    
    lcdoutput:
    
        VALUE = DIMP       'Y = ( DIMP *100 ) / 51   'divided down from * 255 / 130
        VAL1 = VALUE DIG 0 
        VAL2 = VALUE DIG 1 
        VAL3 = VALUE DIG 2 
        VAL4 = VALUE DIG 3 
        VAL5 = VALUE DIG 4 
        LCDOUT 254,Row1+7,"f"
    
        IF VALUE <= 9 THEN
        LCDOUT 254,ROW1,"     ",DEC VAL1
        endif
        
        if value <= 99 then
        lcdout 254,row1,"    ",DEC vAL2,DEC VAL1
        ENDIF
        
        if value <= 999 then
        lcdout 254,row1,"   ",DEC VAL3,DEC VAL2,DEC VAL1
        endif
        
        if value <= 9999 then
        lcdout 254,row1," ",DEC VAL4,",",DEC VAL3,DEC VAL2,DEC VAL1
        endif
    
        if value > 9999 then
        lcdout 254,row1,DEC VAL5,DEC VAL4,",",DEC VAL3,DEC VAL2,DEC VAL1
        endif
    return
    Padawan-78

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Think about it, if it's <9... it's also <99 AND<999 and <9999 huh?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. NMEA CheckSum Routine
    By Tom Gonser in forum Code Examples
    Replies: 2
    Last Post: - 6th June 2015, 22:24
  2. LCDout $FE,2, dec Days - What is dec ?
    By merc07 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th June 2009, 04:03
  3. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  4. Help for my project(16f877,2x16LCD,)
    By karamastik in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 21st March 2008, 23:29
  5. Rc int on 16f874
    By hakan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th July 2007, 18:57

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