How to display many informations on 6 digits?


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2010
    Posts
    8

    Default How to display many informations on 6 digits?

    Hello. I am new here.
    Please help me with this: I want to make a clock with DS1307 and displaying information about the time and date on a display of six digits. I would like for a while, let's say 5 seconds, only to tear the clock, then for the same period, to display the date. And resume the process.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    At hardware are you using?
    Do you have anyhing working?
    Problems in a particular area?
    Code?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Mihai Popa View Post
    Hello. I am new here.
    Please help me with this: I want to make a clock with DS1307 and displaying information about the time and date on a display of six digits. I would like for a while, let's say 5 seconds, only to tear the clock, then for the same period, to display the date. And resume the process.
    Mihai Popa,

    If you have a little info and knowledge of programming, you can come up with your own code, design and finally a working system from this forum in about a week even without asking much about it.

    There are so many similar projects of yours here at this forum.
    Dig in.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    Join Date
    Apr 2010
    Posts
    8


    Did you find this post helpful? Yes | No

    Default How to display many informations on 6 digits?

    Hello.
    We're back with the code and electrical diagram made in Proteus.
    My problem is that I want to toggle between showing the label "afisare_ceas" and labeled "afisare_data." Range of hits to be about 5 seconds.
    Attached Files Attached Files

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default

    I have one older version of Proteus. Please post the schematic in graphic format (.jpg).

  6. #6
    Join Date
    Apr 2010
    Posts
    8


    Did you find this post helpful? Yes | No

    Default How to display many informations on 6 digits?

    Schematics.
    Attached Images Attached Images  

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Looks to me like you're multilpexing the display, right?

    Have loop counter variable incremented each time you get to the citeste_RTC routine. After reading the DS1307 you look at this loop counter and if it's less than say 10000 (or whatever) you jump jump to the routine displaying the time, if it more than 10000 you jump to the routine displaying the date. If it hits 20000 (in this case) you reset it to 0 and the whole thing starts over.

    /Henrik.

  8. #8
    Join Date
    Apr 2010
    Posts
    8


    Did you find this post helpful? Yes | No

    Default How to display many informations on 6 digits?

    Hello.
    You are right.
    But, how write a code?
    thanks

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default

    Hi,
    Something like this:
    Code:
    Counter VAR WORD
     
    Read1307:
      'code for reading time and date here....
     
    Counter = Counter + 1
    If Counter > 2000 then Counter = 0
    If Counter < 1000 Then GOSUB DisplayTime
    If Counter > 1000 Then GOSUB Display Date
    Goto Read1307
     
    DisplayTime:
      'code for time here
    RETURN
     
    DisplayDate:
      'code for date here
    RETURN
     
    END
    Now have a go at it, if it doesn't work post your code and we'll have a look at it again.

    /Henrik.

  10. #10
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default

    Or something like this :
    Code:
    citeste_RTC:
      I2CREAD SDA,SCL,$d1,$00,[STR DB0\8] ' Read 8 bytes from DS1307
    
    ore     = (db0[2] & $F )+((db0[2]>>4)*10) 'formula de conversie Hex to Dec pentru ore,hour
    minute  = (db0[1] & $F )+((db0[1]>>4)*10) 'formula de conversie Hex to Dec pentru minute,minutes
    Secunde = (db0[0] & $F )+((db0[0]>>4)*10) 'formula de conversie Hex to Dec pentru secunde,seconds
    if secunde = 15 or secunde = 30 or secunde = 45 then  
        gosub afisare_data
        else
        gosub afisare_ceas
    endif
    
    Zi      = (db0[4] & $F )+((db0[4]>>4)*10) 'formula de conversie Hex to Dec pentru zile,days
    Luna    = (db0[5] & $F )+((db0[5]>>4)*10) 'formula de conversie Hex to Dec pentru luni,months
    An      = (db0[6] & $F )+((db0[6]>>4)*10) 'formula de conversie Hex to Dec pentru ani,years
    
    anod1=0
    anod2=0
    Anod3=0
    Anod4=0
    anod5=0
    anod6=0
    goto citeste_rtc
    
    
    afisare_ceas:         'display clock
    Digit=secunde dig 1
    gosub convert
    PortC=pattern
    Anod5=1
    pause 1
    anod5=0
    
    digit=secunde dig 0
    gosub convert
    PortC=pattern
    Anod6=1
    pause 1
    anod6=0
    
    Digit=minute dig 1
    gosub convert
    PortC=pattern
    Anod3=1
    pause 1
    anod3=0
    
    Digit=Minute dig 0
    gosub convert
    PortC=pattern
    Anod4=1
    pause 1
    anod4=0
    
    digit=ore dig 1
    gosub convert
    PortC=pattern
    Anod1=1
    pause 1
    anod1=0
    
    digit=ore dig 0
    gosub convert
    PortC=pattern
    Anod2=1
    pause 1
    anod2=0
    return
    
    afisare_data:    'afisare date
    Digit=zi dig 1
    gosub convert
    PortC=pattern
    Anod5=1
    pause 1
    anod5=0
    
    digit=zi dig 0
    gosub convert
    PortC=pattern
    Anod6=1
    pause 1
    anod6=0
    
    Digit=luna dig 1
    gosub convert
    PortC=pattern
    Anod3=1
    pause 1
    anod3=0
    
    Digit=luna dig 0
    gosub convert
    PortC=pattern
    Anod4=1
    pause 1
    anod4=0
    
    digit=an dig 1
    gosub convert
    PortC=pattern
    Anod1=1
    pause 1
    anod1=0
    
    digit=an dig 0
    gosub convert
    PortC=pattern
    Anod2=1
    pause 1
    anod2=0
    ;goto citeste_RTC
    return
    
    convert:
    lookup digit, [$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F],pattern
    pattern=pattern^$FF
    return
    
    end

  11. #11
    Join Date
    Apr 2010
    Posts
    8


    Did you find this post helpful? Yes | No

    Default how to display many informations on 6 ditits?

    Hello. Sorry I did not reply, but I had some work. I managed to do something, and I put the code below. Thank you for your advice.
    Code:
    '****************************************************************
    '*  Name    : Ceas cu DS1307.BAS                                *
    '*  Author  : [Mihai POPA]                                      *
    '*  Notice  : Copyright (c) 2010 [Mihai]                        *
    '*          : All Rights Reserved                               *
    '*  Date    : 5/31/2010                                         *
    '*  Version : 1.3                                               *
    '*  Notes   : Procesor PIC16F690                                *
    '****************************************************************
    OSCCON = %1100100 'Oscilator 4 MHz
    ANSEL = 0         'A/D dezactivat
    ANSELH = 0        'A/D dezactivat
    TrisA = %00000000 'Setare intrare/iesire
    TrisB = %00000000 'Setare intrare/iesire
    TrisC = %00000000 'Setare intrare/iesire
    
    DP   var PortC.7   'punct zecimal, secundar
    Anod1 var PortB.4  'Anod1
    Anod2 var PortB.5  'Anod2
    Anod3 var PortB.6  'Anod3
    Anod4 var PortB.7  'Anod4
    Anod5 var PortA.0  'Anod5
    Anod6 var PortA.1  'Anod6
    
    Secunde var byte
    Minute  var byte
    Ore     var byte
    
    Zi      var byte   'Afiseaza zile
    Luna    var byte   'Afiseaza luni
    An      var byte   'Afiseaza ani
    
    Grup1 var byte
    Grup2 var byte
    Grup3 var byte
    
    Counter1 var byte
    Counter2 var byte
    
    counter1=1              'contor pentru afisare ceas
    counter2=1              'contor pentru afisare data
    
    Perioada var byte      'Perioada de timp cat sta afisata o informatie
    perioada=200           'valoarea initiala a perioadei de afisare
    
    Digit   var byte
    Pattern var byte
    
    'Set_minute var PortA.0 'Buton de setat minute
    'Set_ore    var PortA.1 'Buton de setat ore
    
    SCL var PortA.4     'SCL pentru RTC
    SDA var PortA.5     'SDA pentru RTC
    DB0 var byte[8]     'cuvantul receprionat de la RTC
    
    'setare_RTC:         'Setare data initiala:
      pause 1
      I2CWRITE SDA,SCL,$d0,$00,[$59,$59,$19,$7,$14,$2,$10,$90] ' Write to DS1307
      pause 10
      
    citeste_RTC:
      I2CREAD SDA,SCL,$d1,$00,[STR DB0\8] ' Read 8 bytes from DS1307
    '   lcdout $fe,1,"Time=",hex2 DB0[2],":",hex2 DB0[1],":",hex2 DB0[0]    'bit 0=sec, bit 1=min, bit 2=hrs
    '   lcdout $fe,$c0,"Date=",hex2 DB0[4],":",hex2 DB0[5],":",hex2 db0[6]  'bit 4=day, bit 5=month, bit 6=year
    
    ore     = (db0[2] & $F )+((db0[2]>>4)*10) 'formula de conversie Hex to Dec pentru ore,hour
    minute  = (db0[1] & $F )+((db0[1]>>4)*10) 'formula de conversie Hex to Dec pentru minute,minutes
    Secunde = (db0[0] & $F )+((db0[0]>>4)*10) 'formula de conversie Hex to Dec pentru secunde,seconds
    
    Zi      = (db0[4] & $F )+((db0[4]>>4)*10) 'formula de conversie Hex to Dec pentru zile,days
    Luna    = (db0[5] & $F )+((db0[5]>>4)*10) 'formula de conversie Hex to Dec pentru luni,months
    An      = (db0[6] & $F )+((db0[6]>>4)*10) 'formula de conversie Hex to Dec pentru ani,years
    
    anod1=0
    anod2=0
    Anod3=0
    Anod4=0
    anod5=0
    anod6=0
    
    rutina_afisare_ceas_si_data:
    counter1=counter1+1                     'initializare contor
      if counter1
    
        grup1=secunde                       'daca nu a atins perioada, atunci
        grup2=minute                        'afiseaza ceasul
        grup3=ore
         else                                
              if counter1=perioada  then    'daca contor1 a atins valoarea perioadei,
              counter2=counter2+1           'incrementeaza contor2
                 if counter2
    
                 grup1=an                   'daca nu a atins perioada, atunci
                 grup2=luna                 'afiseaza data
                 grup3=zi
                 endif
              if counter2=perioada then     'verifica daca contor2 a atins perioada
            counter2=1                      'daca contor2 a atins perioada, atunci reseteaza contor2=1
            counter1=1                      'si contor1=1
              endif
         endif   
      endif
      
    afisare_ceas:         'display clock
    Digit=grup1 dig 1
    gosub convert
    PortC=pattern
    Anod5=1
    pause 1
    anod5=0
    
    digit=grup1 dig 0
    gosub convert
    PortC=pattern
    Anod6=1
    pause 1
    anod6=0
    
    Digit=grup2 dig 1
    gosub convert
    PortC=pattern
    Anod3=1
    pause 1
    anod3=0
    
    Digit=grup2 dig 0
    gosub convert
    PortC=pattern
    Anod4=1
    pause 1
    anod4=0
    
    digit=grup3 dig 1
    gosub convert
    PortC=pattern
    Anod1=1
    pause 1
    anod1=0
    
    digit=grup3 dig 0
    gosub convert
    PortC=pattern
    Anod2=1
    pause 1
    anod2=0
    
    goto citeste_RTC
    convert:
    lookup digit, [$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F],pattern
    pattern=pattern^$FF
    return
    end
    </perioada></perioada>
    Last edited by ScaleRobotics; - 1st July 2010 at 16:43. Reason: added code tags

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