+ Reply to Thread
Results 1 to 26 of 26
  1. #1
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    I have Melanies excellent Olympic Timer from 2004 working as a seconds stopwatch, as I need seconds not minutes for Showjumping timing. i.e 128.34 secs (Thanks Melanie)

    However I used a two line 40 character LCD and the numbers are very small.

    I seem to recall in the past I saw a two line LCD showing numbers spread over two lines (two line high) using the custom character feature.

    Anyone have any info on this ??

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

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

    Hmm, a search came up with this on the Arduino forum.

    http://www.arduino.cc/cgi-bin/yabb2/...num=1245352653

    Shows what can be done using just a few segments. I really need to study this one though to use the LCD.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    1,726

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

    Does the datasheet for your LCD mention custom characters?

    As far as I remember, you need a graphic LCD to do that. A character LCD only prints characters, unless it has a custom character feature.

    Robert

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

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

    Most character LCD's allow up to 8 custom characters. I have a 2x8 display on my kids aquariums showing water temp and you have to be very close to read it, this would be a neat way to make the characters larger.
    Shawn

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    552

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

    I thought about implementing this idea some time ago, but them I got discouraged when I read somewhere that these LCD displays only allow a few custom characters like spcw1234 mentioned above. However, looking at the arduino link above it looks like it can be done.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  6. #6
    Join Date
    Aug 2006
    Location
    Look behind you.
    Posts
    2,594

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

    Darrel did it a long time back, I re posted his code here:http://www.picbasic.co.uk/forum/show...hlight=bignums
    search for bignums to see other threads.
    BTW Darrel gives credit to Scott Edwards . . .

    http://www.picbasic.co.uk/forum/showthread.php?p=26736
    http://www.picbasic.co.uk/forum/showthread.php?t=9736
    Last edited by Archangel; - 8th January 2012 at 10:33.
    Anti virus software seems a little like hiring the Mafia to protect you.

    Moderators are just regular members who get to put the KABAM on SPAM



  7. #7
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    This is what I came up with using DT_INTS-18 timer routine. This is with a 2x16 display.

    Code:
    '****************************************************************
    '*  Name    : BigDigitTimer.BAS                                 *
    '*  Author  : Shawn Newswanger                                  *
    '*  Notice  : Copyright (c) 2012                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 1/8/2012                                          *
    '*  Version : 1.0                                               *
    '*  Notes   : PIC18F2221 with internal OSC                      *
    '****************************************************************
    OSCCON=110000            'SET TO 8 MHZ
    define OSC 08               '8MHz oscilator 
    define LCD_COMMANDUS 1500   'set command delay in us
    define LCD_DATAUS 50        'set data delay in us
    define LCD_DREG PORTC       'set LCD data port
    define LCD_DBIT 4           'set LCD starting data bit
    define LCD_RSREG PORTC      'define RS port
    define LCD_RSBIT 2          'define RS bit
    define LCD_EREG PORTC       '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
    
    ADCON1 = 15 'all digital
    CMCON = 7   'turns off comparators 
    
    trisc=0
    trisb=0
    trisa=0
    
    nPos  var byte
    nDig  var byte
    
    'CONFIGURE DISPLAY 
    pause 100
    ln1 con $80
    ln2 con $C0
    CS  con 1
    pause 500
    LCDOUT $FE,1
    
    
    'Set up the digits (http://www.darreltaylor.com/files/CustChar.htm)
      LCDOUT  $FE,$40,$1F,$1F,$1F,$00,$00,$1F,$1F,$1F  ' Cust Char #0  
      LCDOUT  $FE,$48,$1F,$1F,$1F,$00,$00,$00,$00,$00  ' Cust Char #1  
      LCDOUT  $FE,$50,$00,$00,$00,$00,$00,$1F,$1F,$1F  ' Cust Char #2  
      LCDOUT  $FE,$58,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F  ' Cust Char #3  
      LCDOUT  $FE,$60,$00,$0E,$0A,$0E,$00,$00,$00,$00  ' Cust Char #4  
      LCDOUT  $FE,$68,$00,$00,$0E,$0A,$0A,$0E,$00,$00  ' Cust Char #5  
      LCDOUT  $FE,$70,$00,$00,$04,$0A,$0A,$04,$00,$00  ' Cust Char #6  
      LCDOUT  $FE,$78,$00,$00,$00,$00,$00,$00,$00,$00  ' Cust Char #7 
    
    'ELAPSED TIMER
    INCLUDE "DT_INTS-18.bas"
    INCLUDE "ReEnterPBP-18.bas"
    INCLUDE "Elapsed_INT-18.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  
    
    GOSUB ResetTime           ' Reset Time to  0d-00:00:00.00
    GOSUB StartTimer          ' Start the Elapsed Timer
    lcdout $fe, CS            ' Clear screen
    
    MAIN:                     'Display time
      IF secondsChanged = 1 THEN  
         secondsChanged = 0
        nDig=minutes dig 1 : nPos=0 : gosub displaydigit
        ndig=minutes dig 0 : npos=4 : gosub displaydigit
          npos=7 : gosub colon  
        ndig=seconds dig 1 : npos=8 : gosub displaydigit
        ndig=seconds dig 0 : npos=12 : gosub displaydigit
      ENDIF
    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,3,1,3
        LCDOUT $FE,$C0+nPos,3,2,3
    return
    
    One:
        LCDOUT $FE,$80+nPos,1,3,7
        LCDOUT $FE,$C0+nPos,2,3,2
    return
    
    Two:
        LCDOUT $FE,$80+nPos,0,0,3
        LCDOUT $FE,$C0+nPos,3,2,2
    return
    
    Three:
        LCDOUT $FE,$80+nPos,1,0,3
        LCDOUT $FE,$C0+nPos,2,2,3
    return
    
    Four:
        LCDOUT $FE,$80+nPos,3,2,3
        LCDOUT $FE,$C0+nPos,7,7,3
    return
    
    Five:
        LCDOUT $FE,$80+nPos,3,0,0
        LCDOUT $FE,$C0+nPos,2,2,3
    return
    
    Six:
        LCDOUT $FE,$80+nPos,3,0,0
        LCDOUT $FE,$C0+nPos,3,2,3
    return
    
    Seven:
        LCDOUT $FE,$80+nPos,1,1,3
        LCDOUT $FE,$C0+nPos,7,3,7
    return
    
    Eight:
        LCDOUT $FE,$80+nPos,3,0,3
        LCDOUT $FE,$C0+nPos,3,2,3
    return
    
    Nine:
        LCDOUT $FE,$80+nPos,3,0,3
        LCDOUT $FE,$C0+nPos,7,7,3
    return
    
    colon:
        lcdout $fe,$80+nPos,5
        lcdout $FE,$C0+nPos,5
    return
    
    end
    Name:  IMAG0559.jpg
Views: 517
Size:  949.8 KB
    Shawn

  8. #8
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    That looks great Shawn for my future projects but not for my timer.
    I was incorrect about my display, I used a 2x16 as well but I need to display say, 123.45 so the thinner dual height figures are just what I want. I believe i can't use them anyway.
    Melanies code is quite 'timing' critical as it should be, so I think adding the character code lookup would cause it's timing to be incorrect. I need to study it all again when I get time as I made this a year ago. I do believe there's an 'offset' in the code I can use to bring it back to correct timing I just need to experiment.

    This is Melanies slightly modified code for seconds and hundreths, this uses a 16f628

    Code:
        ' Show Jumping Timer 2011 based on Olympic Timer by Melanie Newman
    '       05/Aug/2004
    '       Topical Program demonstrates use of Interrupt
    '       Driven Background TIMER, to time events down to
    '       one one-hundredth of a Second (1/100 Sec).
    '
    '       Bonus CALIBRATION Feature allows simple adjustments
    '       in 360mS steps per hour. This calibration adjustment
    '       range is limited to +/- 36 seconds per Hour.
    '
    '       This program is for 4MHz clock (1uS Timer Ticks).
    '
    '       PIC Defines
    '       ===========
    '
    '       Change these defines to suit your chosen PIC
    '
    @ DEVICE  pic16F628, XT_OSC    ' System Clock Options
    @ DEVICE  pic16F628, WDT_ON    ' Watchdog Timer
    @ DEVICE  pic16F628, PWRT_ON   ' Power-On Timer
    @ DEVICE  pic16F628, BOD_ON    ' Brown-Out Detect
    @ DEVICE  pic16F628, LVP_OFF   ' Low-Voltage Programming
    @ DEVICE  pic16F628, CPD_OFF   ' Data Memory Code Protect
    @ DEVICE  pic16F628, PROTECT_OFF
                                   ' Program Code Protection
    @ DEVICE pic16F628, WRT_OFF    ' Flash Memory Word Enable
    '
    '       Hardware Defines
    '       ================
            '
            '       LCD Display
            '       -----------
            '       Adjust these to suit your chosen LCD pinout
            '
    Define LCD_DREG PORTB          ' Port for LCD Data
    Define LCD_DBIT 4              ' Use upper 4 bits of Port
    Define LCD_RSREG PORTB         ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 3             ' Port Pin for RS bit
    Define LCD_EREG PORTB          ' Port for Enable (E) bit
    Define LCD_EBIT 1              ' Port Pin for E bit
    Define LCB_BITS 4              ' Using 4-bit bus
    Define LCD_LINES 2             ' Using 2 line Display
    Define LCD_COMMANDUS 2000
                                   ' Command Delay (uS)
    Define LCD_DATAUS 50           ' Data Delay (uS)
              '
            '      Control Buttons/Lines
            '      ---------------------
    ButStart var PortA.0          ' Take this pin low momentarily to START timing
    ButStop var PortA.1           ' Take this pin low momentarily to STOP timing
    ButReset var PortA.2          ' Take this pin low momentarily to RESET clock
            '
            '      Hold the RESET Button pressed for at least FIVE seconds
            '      to jump into CALIBRATION Mode
    '
    '       Software Defines
    '       ----------------
    BannerOffset var BYTE         ' Variable holding start address of Banner Display
    CounterA var BYTE             ' Just a Counter
    CounterB var BYTE             ' Just a Counter
    CounterC var BYTE
    DataA var BYTE
    'Hours var BYTE
    Hundredths var BYTE
    'Minutes var BYTE
    OverflowError var BIT
    RunningFlag var BIT
    Seconds var BYTE
    SetupTimeOut var WORD         ' Timeout counter for Calibration/Set-Up Mode
    TMR1Cal var BYTE              ' Calibration Value
                  TMR1CalAR var Byte             ' Calibration 0=ADVANCE, 1=RETARD
            TMR1RunOn var WORD             ' variable holding TMR1 Run-On value
            '
            '       EEPROM Presets
            '       --------------
            Data @0,0                      ' Advance/Retard Indicator
            Data 0                         ' Calibration Value
            Data "Show Jumping Seconds Timer - Robert Lane 2011"
            '
            '       Software Constants
            '       ------------------
            TMR1CalMax con 100             ' Maximum adjustment (+/-100uS per 10mS interrupt)
            TMR1Preset con $D910           ' 10mS Timer Reload value, offset by 20uS
                                           ' to allow for TMR1 Setting Calculations
            '
            '       Start Program
            '       =============
                    '
                    '       Initialise Processor
                    '       --------------------
            TRISA=000000
            TRISB=000111
            'TRISC=000000
            ADCON0=000000
            ADCON1=000111
            OPTION_REG.7=0                 ' Enable Pull-Up's
            RunningFlag=0                   ' Disable actual Interrupt Time-Keeping
            Pause 1000                     ' Pause for LCD to initialise
                           '
                           '        Silly Intro Banner just for Fun
                           '        -------------------------------
            LCDOut $FE,1                   ' Clear LCD
            BannerOffset=2:Gosub DisplayBanner
            Pause 2000
            For CounterA=0 to 30
                    BannerOffset=2+CounterA
                    Gosub DisplayBanner
                    Pause 150
                    Next CounterA
            Pause 1000
                    '
                    '       Initialise TMR1 Interrupts
                    '       --------------------------
            Gosub SetTimer                 ' Set the Timer for next 10mS Interrupt
            On Interrupt goto TickCount
            PIE1.0=1                       ' Enable TMR1 Interrupts
            INTCON.6=1                     ' Enable all unmasked Interrupts
            INTCON.7=1                     ' Enable Global Interrupts
                    '
                    '       -----------------------------------------------------
                    '       Following the above "On Interrupt", no Basic Command
                    '       is allowed that takes more than 10mS to execute
                    '       otherwise the 10mS Interrupt interval is compromised.
                    '       -----------------------------------------------------
                    '
                    '       Reset Timer Variables for Start
                    '       -------------------------------
    DisplayReset:
            LCDOut $FE,1                   ' Clear LCD
            Read 0,TMR1CalAR               ' Read Calibration Advance/Retard Indicator
            Read 1,TMR1Cal                 ' Read Calibration Value
            Hundredths=0                   ' Reset Timer Counter variables
            Seconds=0
            'Minutes=0
            'Hours=0
            OverflowError=0
            '
            '       Main Program Loop
            '       =================
            Enable
    DisplayLoop:
            If ButStart=0 then RunningFlag=1
            If ButStop=0 then RunningFlag=0
           ' LCDOut $FE,$80,DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds,".",DEC2 Hundredths
           LCDOut $FE,$80,DEC2 Seconds,".",DEC2 Hundredths
               If OverflowError=1 then
                    If Seconds.0=1 then
                           LCDOut $FE,$8C,"ERR"
                           else
                           LCDOut $FE,$8C,"    "
                           endif
                    endif
            If RunningFlag=1 then goto DisplayLoop
            If ButReset=1 then goto DisplayLoop
            Disable
            '
            '       Reset Clock
            '       ===========
            '       Momentarily Press the Reset Button for RESET action.
            '       Continue holding the Reset Button for MORE than 5 seconds
            '       to jump into Calibration/Set-Up Mode
            '
    ResetClock:
            LCDOut $FE,1,"Reset OK"
            Pause 1000
            Seconds=1
            While Seconds < 5
                    Pause 1000
                    If ButReset=1 then goto DisplayReset
                    Seconds=Seconds+1
                    Wend
            '
            '       Calibration Adjustment
            '       ======================
            '       If No Button is Pressed for 20 Seconds, then the program
            '       will automatically exit Calibration/Set-Up Mode WITHOUT saving
            '       any new values.
            '
            SetUpTimeout=0
    Calibration:
            LCDOut $FE,1,"Calibrate: "
            While ButReset=0:Wend          ' Wait for User to release finger
    CalibrationLoop:
            LCDOut $FE,$8B
            If TMR1Cal=0 then
                    LCDOut " "
                    else
                    If TMR1CalAR=0 then
                           LCDOut "+"
                           else
                           LCDOut "-"
                           endif
                    endif
            LCDOut #TMR1Cal," "
                    '       ----------------------------------------------------------
                    '       Press Start Button to ADVANCE (speed-up) Clock
                    '       Press STOP Button to RETARD (slow-down) Clock
                    '       Press RESET Button to SAVE new Calibration Setting
                    '       ----------------------------------------------------------
                    '       Remember each Calibration 'tick' will advance or
                    '       retard the Timing by 1uS in every 10mS period - that's
                    '       360mS/Hour per setting. Example: A setting of +8 will
                    '       SPEED-UP the Timer by 2.88 Seconds (8 x 360mS) in an Hour.
                    '       ----------------------------------------------------------
            If TMR1CalAR=0 then
                    If ButStart=0 then Gosub CalAdvance
                    If ButStop=0 then Gosub CalRetard
                    else
                    If ButStart=0 then Gosub CalRetard
                    If ButStop=0 then Gosub CalAdvance
                    endif
            If ButReset=0 then
                    Write 0,TMR1CalAR
                    Write 1,TMR1Cal
                    LCDOut $FE,1,"Bye Rob"
                    Pause 1000
                    Goto DisplayReset
                    endif
            SetupTimeout=SetupTimeout+1
            If SetupTimeout>200 then goto DisplayReset
            Pause 100
            Goto CalibrationLoop
                    '
            '       Subroutine Increments Calibration Value
            '       ---------------------------------------
    CalAdvance:
            SetupTimeout=0
            If TMR1Cal=>TMR1CalMax then
                    TMR1Cal=TMR1cALmAX
                    TMR1CalAR=TMR1CalAR^1
                    else
                    TMR1Cal=TMR1Cal+1
                    endif
            Return
            '
            '       Subroutine Decrements Calibration Value
            '       ---------------------------------------
    CalRetard:
            SetupTimeout=0
            If TMR1Cal=0 then
                    TMR1Cal=1
                    TMR1CalAR=TMR1CalAR^1
                    else
                    TMR1Cal=TMR1Cal-1
                    endif
            Return
            '
            '       Subroutine Displays Banner Intro
            '       --------------------------------
    DisplayBanner:
            CounterC=BannerOffset+15
            LCDOut $FE,$80
            For CounterB=BannerOffset to CounterC
                    Read CounterB,DataA
                    LCDOut DataA
                    Next CounterB
            Return
            '
            '       Subroutine Loads TMR1 values
            '       ============================
    SetTimer:
            T1CON.0=0                     ' Stop the Clock
            TMR1RunOn.Highbyte=TMR1H       ' Load the Run-On (Over-Run) value (if any)
            TMR1RunOn.Lowbyte=TMR1L
            TMR1RunOn=TMR1Preset+TMR1RunOn
                                          ' Calculate the New (adjusted) value for TMR1
            If TMR1CalAR=0 then            ' Calibration ADVANCE (add) or RETARD (subtract)
                    TMR1RunOn=TMR1RunOn+TMR1Cal
                    else
                    TMR1RunOn=TMR1RunOn-TMR1Cal
                    endif
            TMR1H=TMR1RunOn.Highbyte       ' Save new values to TMR1
            TMR1L=TMR1RunOn.Lowbyte
            T1CON.0=1                     ' Restart the Clock
            PIR1.0=0                      ' Reset TMR1's Interupt Flag
            Return
            '
            '       Timer Interrupt Handler
            '       =======================
    TickCount:
            Gosub SetTimer                ' Set the Timer for next 10mS Interrupt
            If RunningFlag=1 then          ' If timing actually enabled... then...
                    Hundredths=Hundredths+1
                                          ' Increment 10mS Seconds Counter
                    If Hundredths>99 then
                           Hundredths=0
                           Seconds=Seconds+1
                           
                            ' Increment the Seconds -- Show Jumping to 500
                           If Seconds>500 then
                                   Seconds=0
                                   endif
                           
                           
                           
                                          ' Increment the Seconds
                        '   If Seconds>59 then
                         '          Seconds=0
                           '        Minutes=Minutes+1
                                          ' Increment the Minutes
                             '      If Minutes>59 then
                              '            Minutes=0
                                '          Hours=Hours+1
                                          ' Increment the Hours
                            ' If Hours>99 then
                             ' Handle any Overflow
                              '      Hours=0
                             '       OverFlowError=1
                              '      endif
                            ' endif
                      ' endif
                 endif
           endif
    Resume
    End

  9. #9
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    Yes these digits are a display hog They will work well for me since I will be displaying time and temperature.
    Shawn

  10. #10
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    552

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

    Quote Originally Posted by spcw1234 View Post
    This is what I came up with using DT_INTS-18 timer routine. This is with a 2x16 display.

    Code:
    '****************************************************************
    '*  Name    : BigDigitTimer.BAS                                 *
    '*  Author  : Shawn Newswanger                                  *
    '*  Notice  : Copyright (c) 2012                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 1/8/2012                                          *
    '*  Version : 1.0                                               *
    '*  Notes   : PIC18F2221 with internal OSC                      *
    '****************************************************************
    OSCCON=110000            'SET TO 8 MHZ
    define OSC 08               '8MHz oscilator 
    define LCD_COMMANDUS 1500   'set command delay in us
    define LCD_DATAUS 50        'set data delay in us
    define LCD_DREG PORTC       'set LCD data port
    define LCD_DBIT 4           'set LCD starting data bit
    define LCD_RSREG PORTC      'define RS port
    define LCD_RSBIT 2          'define RS bit
    define LCD_EREG PORTC       '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
    
    ADCON1 = 15 'all digital
    CMCON = 7   'turns off comparators 
    
    trisc=0
    trisb=0
    trisa=0
    
    nPos  var byte
    nDig  var byte
    
    'CONFIGURE DISPLAY 
    pause 100
    ln1 con $80
    ln2 con $C0
    CS  con 1
    pause 500
    LCDOUT $FE,1
    
    
    'Set up the digits (http://www.darreltaylor.com/files/CustChar.htm)
      LCDOUT  $FE,$40,$1F,$1F,$1F,$00,$00,$1F,$1F,$1F  ' Cust Char #0  
      LCDOUT  $FE,$48,$1F,$1F,$1F,$00,$00,$00,$00,$00  ' Cust Char #1  
      LCDOUT  $FE,$50,$00,$00,$00,$00,$00,$1F,$1F,$1F  ' Cust Char #2  
      LCDOUT  $FE,$58,$1F,$1F,$1F,$1F,$1F,$1F,$1F,$1F  ' Cust Char #3  
      LCDOUT  $FE,$60,$00,$0E,$0A,$0E,$00,$00,$00,$00  ' Cust Char #4  
      LCDOUT  $FE,$68,$00,$00,$0E,$0A,$0A,$0E,$00,$00  ' Cust Char #5  
      LCDOUT  $FE,$70,$00,$00,$04,$0A,$0A,$04,$00,$00  ' Cust Char #6  
      LCDOUT  $FE,$78,$00,$00,$00,$00,$00,$00,$00,$00  ' Cust Char #7 
    
    'ELAPSED TIMER
    INCLUDE "DT_INTS-18.bas"
    INCLUDE "ReEnterPBP-18.bas"
    INCLUDE "Elapsed_INT-18.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  
    
    GOSUB ResetTime           ' Reset Time to  0d-00:00:00.00
    GOSUB StartTimer          ' Start the Elapsed Timer
    lcdout $fe, CS            ' Clear screen
    
    MAIN:                     'Display time
      IF secondsChanged = 1 THEN  
         secondsChanged = 0
        nDig=minutes dig 1 : nPos=0 : gosub displaydigit
        ndig=minutes dig 0 : npos=4 : gosub displaydigit
          npos=7 : gosub colon  
        ndig=seconds dig 1 : npos=8 : gosub displaydigit
        ndig=seconds dig 0 : npos=12 : gosub displaydigit
      ENDIF
    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,3,1,3
        LCDOUT $FE,$C0+nPos,3,2,3
    return
    
    One:
        LCDOUT $FE,$80+nPos,1,3,7
        LCDOUT $FE,$C0+nPos,2,3,2
    return
    
    Two:
        LCDOUT $FE,$80+nPos,0,0,3
        LCDOUT $FE,$C0+nPos,3,2,2
    return
    
    Three:
        LCDOUT $FE,$80+nPos,1,0,3
        LCDOUT $FE,$C0+nPos,2,2,3
    return
    
    Four:
        LCDOUT $FE,$80+nPos,3,2,3
        LCDOUT $FE,$C0+nPos,7,7,3
    return
    
    Five:
        LCDOUT $FE,$80+nPos,3,0,0
        LCDOUT $FE,$C0+nPos,2,2,3
    return
    
    Six:
        LCDOUT $FE,$80+nPos,3,0,0
        LCDOUT $FE,$C0+nPos,3,2,3
    return
    
    Seven:
        LCDOUT $FE,$80+nPos,1,1,3
        LCDOUT $FE,$C0+nPos,7,3,7
    return
    
    Eight:
        LCDOUT $FE,$80+nPos,3,0,3
        LCDOUT $FE,$C0+nPos,3,2,3
    return
    
    Nine:
        LCDOUT $FE,$80+nPos,3,0,3
        LCDOUT $FE,$C0+nPos,7,7,3
    return
    
    colon:
        lcdout $fe,$80+nPos,5
        lcdout $FE,$C0+nPos,5
    return
    
    end
    Attachment 6218
    Nice code and well organized code structure. Thanks for sharing.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  11. #11
    Join Date
    Jan 2011
    Location
    Skopje,Macedonia
    Posts
    71

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

    where I can find this bas files:

    INCLUDE "DT_INTS-18.bas" INCLUDE "ReEnterPBP-18.bas" INCLUDE "Elapsed_INT-18.bas"

    thanks

  12. #12
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    Quote Originally Posted by SKOLS1 View Post
    where I can find this bas files:

    INCLUDE "DT_INTS-18.bas" INCLUDE "ReEnterPBP-18.bas" INCLUDE "Elapsed_INT-18.bas"

    thanks
    http://darreltaylor.com/DT_INTS-18/home.html
    Shawn

  13. #13
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    Shawn, you've copyrighted and reserved the rights. Is it all right with you that I modify it and put it on here ?

  14. #14
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    Quote Originally Posted by tasmod View Post
    Shawn, you've copyrighted and reserved the rights. Is it all right with you that I modify it and put it on here ?
    Copy all you want, most of the code was copied off of this site as it is already!
    Shawn

  15. #15
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    Thanks, it's just that normally I wouldn't add the copyright notice for anything for open source public consumption.

    I'm trying to use just the seconds and 'ticks'

  16. #16
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    MCS adds that automatically the way I have it set up. I will change that for future posts. Thanks for pointing it out.
    Shawn

  17. #17
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    OK, I have the Dt_ints stopwatch version working on my display using the thinner characters as i.e. 123:45

    This works bar one problem.

    It will not display the Character 0 code it is just an all pixel black block. So this affects the numbers 1, 4, 7.

    The code I mean is
    LCDOUT $FE,$40,$01,$01,$01,$01,$01,$01,$01,$01

    According to the sheet that came with the display it has 16 CGRAM custom character spaces available.

    I tried using Character 8 instead . i.e. LCDOUT $FE,$80,$01,$01,$01,$01,$01,$01,$01,$01
    this produced a curled 'J' character which is not part of the inbuilt set.

    I can't figure this one out??? Any ideas please ?

  18. #18
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    You have the LCDOUT command correct to display a '1' I don't see any problems. I feel the problem is somewhere else in your code. All the other 7 characters work fine?
    Shawn

  19. #19
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    Grrr, how come when I post the problem it immediately solves itself. I just resaved the bas file under a different name and reprogrammed the chip and it works!

    Thanks for the input Shawn.

    I now have a stopwatch that works and will have easier to read characters. :-)

  20. #20
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

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

    I know what you mean!
    Shawn

  21. #21
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

    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 ??

  22. #22
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

    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

  23. #23
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    127

    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

  24. #24
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

    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?

  25. #25
    Join Date
    Jan 2009
    Posts
    151

    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.

  26. #26
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    189

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

    Hi Mark,


    Hi, we are pleased to see that you are using our forum.

    We'd like you to become a member of our community. Membership is FREE, please REGISTER and view our forums without these annoying reminders!

    Once registered you may post on the forums, download from the file areas and use the WIKI without interruption.






    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 : 4

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