How to display many informations on 6 digits?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    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

  2. #2
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

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

  3. #3
    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  

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    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.

  5. #5
    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

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    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.

  7. #7
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    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

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