Two line LCD double height numbers, possible ???


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    I know what you mean!
    Shawn

  2. #2
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    Ahh, I spoke to soon. It does work but not as I would want.

    I believe it's in the assembler bit of Elapsed_Int that I need to make a change but I don't know where to start. :-(

    The 3 x seconds digits rollover at 59.99 and zero again. The digits do not continue to 60, 61 etc. the first digit stays at 0 as well. I need it to continue to 3 x seconds digits probably ending at 500 but not essential. So that 129.54 would be possible say.

    Anyone give me a clue ??

  3. #3
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    This is the code I have :-

    Code:
    '****************************************************************                                             *
    '*             : PIC16F628                                      *
    '****************************************************************
    
    ;-- Place a copy of these variables in your Main program -------------------
    ;--   The compiler will tell you which lines to un-comment                --
    ;--   Do Not un-comment these lines                                       --
    ;---------------------------------------------------------------------------
    ;wsave   VAR BYTE    $20     SYSTEM      ' location for W if in bank0
    wsave   VAR BYTE    $70     SYSTEM      ' alternate save location for W 
                                             ' if using $70, comment wsave1-3
    
    ' --- IF any of these three lines cause an error ?? ------------------------
    '       Comment them out to fix the problem ----
    ' -- Which variables are needed, depends on the Chip you are using -- 
    wsave1  VAR BYTE    $A0     SYSTEM      ' location for W if in bank1
    wsave2  VAR BYTE    $120    SYSTEM      ' location for W if in bank2
    ;wsave3  VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    ' --------------------------------------------------------------------------
    
    define OSC 10               'oscillator setting
    define LCD_COMMANDUS 1500   'set command delay in us
    define LCD_DATAUS 50        'set data delay in us
    define LCD_DREG PORTB       'set LCD data port
    define LCD_DBIT 4           'set LCD starting data bit
    define LCD_RSREG PORTB      'define RS port
    define LCD_RSBIT 2          'define RS bit
    define LCD_EREG PORTB       'set LCD ENABLE port
    define LCD_EBIT 3           'set LCD ENABLE bit
    define LCD_BITS 4           'set LCD bits 4 or 8
    define LCD_LINES 2          'set # of LCD rows 2 or 4
    clear
    
    cmcon=7
    trisb=%00000000
    trisa=%11111111
    input  porta.0
    input  porta.1
    input  porta.2
    
    nPos  var byte
    nDig  var byte
    
    'CONFIGURE DISPLAY 
    pause 100
    ln1 con $80
    ln2 con $C0
    CS  con 1
    pause 500
    LCDOUT $FE,1
    
    'setup the custom characters
    LCDOUT  $FE,$40,$01,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #0 
    LCDOUT  $FE,$48,$1F,$11,$11,$11,$11,$11,$11,$11  ' Cust Char #1  
    LCDOUT  $FE,$50,$1F,$10,$10,$10,$10,$10,$10,$1F  ' Cust Char #2  
    LCDOUT  $FE,$58,$01,$01,$01,$01,$01,$01,$01,$1F  ' Cust Char #3  
    LCDOUT  $FE,$60,$1F,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #4  
    LCDOUT  $FE,$68,$11,$11,$11,$11,$11,$11,$11,$1F  ' Cust Char #5  
    LCDOUT  $FE,$70,$1F,$01,$01,$01,$01,$01,$01,$1F  ' Cust Char #6  
    LCDOUT  $FE,$78,$1F,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #7 
    LCDOUT  $FE,$80,$01,$01,$01,$01,$01,$01,$01,$01  ' Cust Char #0 
    
    'ELAPSED TIMER
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    INCLUDE "Elapsed_INT.bas"  ; Elapsed Timer Routines
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE  TMR1_INT  ; Enable Timer 1 Interrupts  
    
    lcdout $fe, CS            ' Clear screen
    
    MAIN:                     'Display time
      if porta.0 = 1 then GOSUB StartTimer     ' Start the Elapsed Timer
      if porta.1 = 1 then gosub StopTimer
      if porta.2 = 1 then GOSUB ResetTime      ' Reset Time
      
        nDig=seconds dig 2 : nPos=0 : gosub displaydigit   'hundreds
        nDig=seconds dig 1 : nPos=1 : gosub displaydigit   'tens
        ndig=seconds dig 0 : npos=2 : gosub displaydigit   'ones
        LCDOUT $FE,$C0+3,":" 
        ndig=ticks dig 1 : npos=4 : gosub displaydigit     'tenths
        ndig=ticks dig 0 : npos=5 : gosub displaydigit     'hundreths
     
    goto main
    
    displaydigit:
    if ndig=0 then gosub zero
    if ndig=1 then gosub One
    if ndig=2 then gosub Two
    if ndig=3 then gosub Three
    if ndig=4 then gosub Four
    if ndig=5 then gosub Five
    if ndig=6 then gosub Six
    if ndig=7 then gosub Seven
    if ndig=8 then gosub Eight
    if ndig=9 then gosub nine
    return
    
    Zero:
    	LCDOUT $FE,$80+nPos,1
    	LCDOUT $FE,$C0+nPos,5
    return
    
    One:
    	LCDOUT $FE,$80+nPos,0
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Two:
    	LCDOUT $FE,$80+nPos,7
    	LCDOUT $FE,$C0+nPos,2
    return
    
    Three:
    	LCDOUT $FE,$80+nPos,6
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Four:
    	LCDOUT $FE,$80+nPos,5
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Five:
    	LCDOUT $FE,$80+nPos,2
    	LCDOUT $FE,$C0+nPos,3
    return
    
    Six:
    	LCDOUT $FE,$80+nPos,2
    	LCDOUT $FE,$C0+nPos,5
    return
    
    Seven:
    	LCDOUT $FE,$80+nPos,7
    	LCDOUT $FE,$C0+nPos,0
    return
    
    Eight:
    	LCDOUT $FE,$80+nPos,4
    	LCDOUT $FE,$C0+nPos,5
    return
    
    Nine:
    	LCDOUT $FE,$80+nPos,4
    	LCDOUT $FE,$C0+nPos,3
    return
    
    end

  4. #4
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    The timer works like a clock. when seconds roll over from 59 it will go to 00 and minutes will advance. There is no hundreds position in the seconds.
    Shawn

  5. #5
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    Hmm, yes. But it must be possible for it to continue instead of rolling over. This is what I altered in Melanies code to do this, however that was all PBP and no assembler.

    That's where I'm lost. The code in Elapsed_INT I'm sure can be modified to continue counting the seconds into the seconds byte without a rollover, but where in the code?

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    You can modify the "Elapsed_INT.bas". If you open this file you will see some pbp code at "ClockCount:" . You can change the if statements for Hours, minutes, and seconds. Or you can add another varible and maintain the original code. I added the code in bold. Hope it helps.

    Code:
    seconds2 var word 'place in main code
    ClockCount:
    @ RELOAD_TIMER                    ; Reload TIMER1
        Ticks = Ticks + 1
        if Ticks = 100 then
           Ticks = Ticks-100
           Seconds = Seconds + 1
    SecondsChanged = 1
    seconds2 = seconds2 + 1
     If seconds2 = 500 then ' Rollover at 500 seconds
      seconds2= 0
       
           if Seconds = 60 then
              Minutes = Minutes + 1
              MinutesChanged = 1
              Seconds = 0
           endif
           if Minutes = 60 then
              Hours = Hours + 1
              HoursChanged = 1
              Minutes = 0
           endif
           if Hours = 24 then
              Days = Days + 1
              DaysChanged = 1
              Hours = 0
           endif
        endif
    @ INT_RETURN                      ; Restore context and return from
    Last edited by mark_s; - 10th January 2012 at 22:21.

  7. #7
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: Two line LCD double height numbers, possible ???

    Hi Mark,

    Many thanks, I was just logging in to report what an idiot I am and to say it all works.

    I had done all that and more but it still refused to work.

    Doh, turns out I was altering a spare copy of Elapsed_INT in another folder !!!

    I'm going to turn on the MCS option to show the full path so in future i won't make the same mistake again.

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