Digital Clock using 18x starter pack

rabag

New Member
Dear Sir/Madam,

I have a quad seven segment display and a 18x starter pack with 4x 4026b decade counter chips. I am trying to display the time on the quad seven segment Common Cathode display. Any help would be greatly received.
The information I have gathered so far seems to suggest using a DS1307. Any help on how I can implement this into a circuit and whether its the correct IC to use. Also I am a trainee teacher and am very new to picaxe programming and electronics. I have the picaxe book but would be extremely grateful for any guidance on programming the clock and building the circuit.

Thanks
ryan
 

Michael 2727

Senior Member
I like the 4026 chips, but for a clock you would probably
be better off using a multiplexed segment driver and
update each digit as needed. The 4026s can only increment
the input count, so 24:00 will need 2,400 input pulses to
refresh the display, it can be done, but is a little clunky
unless you have a super fast output.
You could drive each segment separately rather than
cascading the 4026 chips together.

There is a lot of info in the archives, try searching,
you may find what you need to know, then again search
does not always produce the desired result.
Start with the DS1307, then 7-seg displays etc.

Welcome to the forum -

Your Thread may get shifted to the Current Forum
as this section is for completed projects :)
 
Last edited:

Rickharris

Senior Member
Dear Sir/Madam,

I have a quad seven segment display and a 18x starter pack with 4x 4026b decade counter chips. I am trying to display the time on the quad seven segment Common Cathode display. Any help would be greatly received.
The information I have gathered so far seems to suggest using a DS1307. Any help on how I can implement this into a circuit and whether its the correct IC to use. Also I am a trainee teacher and am very new to picaxe programming and electronics. I have the picaxe book but would be extremely grateful for any guidance on programming the clock and building the circuit.

Thanks
ryan
Your circuit for the 7 seg display can be found in the Interface PDF page 21

Page 22 shows how to cascade the 4026 for further displays. A bread board and some time to play with this - simply feeding the 4026 with pulses to show different numbers. Remember that the 4026 resets and counts through from zero every time you change the number but if you do this very quickly you don't see the numbers changing.

There is a data sheet for the clock with examples of how to connect in the REV ed shop for that component. See top of this page.

A search of the forum for IC2 will get you some information on how to connect and communicate via ICs protocol. The PDF manuals have some sample code.

Essentially th RTC provides regular accurate clock timefor the picaxe to work from.

As always with a complex idea start with simple bits and get them working - The displays - Then ICs2communication - then the RTC.

Write down what you need the clock to do in english words as a flow chart. Nothing complex but in the right order. This will then give you a focus for building some code.

Break the code into small sections if possible that all do individual but complete tasks - this makes finding errors much simpler - if the display isn't correct it must be the display routine.

Example of clock flow:

Start

Check for setting signal (to initially set the clock time)
Get clock time
Send to display
Wait for 1 second
Goto the start for the next time display.


Play around with your picaxe and simple things - flash an LED every second - Flash an LED hours - Mins and seconds (who needs a 7 seg display!) Use the internal oscillator (pause command) it won't be long term accurate but you can get things working up to getting an accurate time signal.

Above all have a go, you are very unlikely to break anything if you stick to battery power.
 
Last edited:

BeanieBots

Moderator
I've moved your thread to the active forum where you are likely to get more replies.
The DS1307 RTC chip is probably the easiest way to get time information.
Please note, it requires a PICAXE with I2C support (eg 18X).
You will need to do a little hacking of the starter board to make the correct connections. It presents its data in BCD format. We can help you with that later if required. Meanwhile, as already suggested, get the display to work first. Then worry about how to read the time and then how to decode the values into displayable format.
 

Michael 2727

Senior Member
I'll retract my original -
The 4026s can only increment
the input count, so 24:00 will need 2,400 input pulses to
refresh the display
Then I was thinking, (that could be dangerous) seeing
that you don't need the seconds, you have plenty of
time to fiddle around in the code between each minutes.

That way you don't need reset the display, rather just
adding the 41 pulses at the end of every 59th min, to
( ??:00 ) zero the display and correctly increment the
hour count. And @ 24:00 just reset all segments.
(I think thats how I did it on my 15 min stopwatch
it's been a while)

I've never played with the RTC chip, but would think
it would be fairly straight forward to pick off each
new Minute increment and spit out a 1 pulse to the
Mins Segs, then add the extra 41 pulses every 59th min.

$0.02c worth.
 

saunj

Senior Member
Using DS1307 and common-cathode LED displays

I used a module containing a DS1307 in a clock using a 18X. See
http://www.worsleyassociates.com/Projects/LED_Display
I actually bought a module containing the DS1307, a crystal, and a battery on a small board.
It has been keeping very good time and doesn't need the clock to be always plugged in.

I used a MC14489 multiplexed LED driver in this project:
http://www.worsleyassociates.com/Projects/Altimeter/index.html
It should drive your display directly and has a serial input

Both projects are also in the finished projects forum.

Good luck
 

hippy

Technical Support
Staff member
Using a common reset and separate increment lines to control the four digit drivers should be a simple means of controlling the time display with a minimum of 'extra increments' required once the time has been set. No need to cascade the counters, a maximum of 24 increments required to set any time.

An alternative to using a DS1307 is to configure the 18X to run an internal timer from a 32kHz watch crystal attached directly to the PICAXE (RB6/RB7). The software may be a little more complicated but not overly. There are mechanisms which can be used to keep the clock running when the main power fails. A clock designed this way should keep time as accurately as a DS1307.

Code:
; *****************************************************************************
; *                                                                           *
; *     LED Toggling Using Timer1 Bit Polling from External Oscillator        *
; *                                                                           *
; *     With a 32kHz external clock, divide by 1 pre-scaling and polling      *
; *     bit6 of the Timer1 MSB, the LED should be on for exactly 500mS and    *
; *     off for 500mS, exactly 1Hz.                                           *
; *                                                                           *
; *     Testing was done with watch crystal legs held against the PICAXE      *
; *     legs. For maximum accuracy 33pF caps should go from O6 and O7 to 0V   *
; *     as per the 16F88 datasheet.                                           *
; *                                                                           *
; *****************************************************************************

;        PICAXE-18A
;        PICAXE-18X
;       .----------.    _______
;       |       O7 |---|       |   32.768kHz XTAL
;       |       O6 |---|_______|
;       |          |
;       |          |    ___    LED
;       |       O3 |---|___|---|>|---.
;       `----------'                _|_ 0V

;       SFR Addresses

        SYMBOL  TMR1H           = $0F
        SYMBOL  T1CON           = $10

;       T1CON

        SYMBOL  T1RUN_BIT       = bit6
        SYMBOL  T1CKPS1_BIT     = bit5
        SYMBOL  T1CKPS0_BIT     = bit4
        SYMBOL  T1OSCEN_BIT     = bit3
        SYMBOL  T1SYNC_BIT      = bit2
        SYMBOL  TMR1CS_BIT      = bit1
        SYMBOL  TMR1ON_BIT      = bit0

; *****************************************************************************
; *                                                                           *
; *     Main Program Loop                                                     *
; *                                                                           *
; *****************************************************************************

        T1RUN_BIT       = 0             ; Internal System Clock
        T1CKPS1_BIT     = 0             ; Divide by 1 Pre-Scaler
        T1CKPS0_BIT     = 0             ; Divide by 1 Pre-Scaler
        T1OSCEN_BIT     = 1             ; External LP Oscillator Enabled
        T1SYNC_BIT      = 1             ; Synchronised to System Clock
        TMR1CS_BIT      = 1             ; External Clock
        TMR1ON_BIT      = 1             ; Timer 1 Enabled

        POKE T1CON,b0                   ; Set T1CON

        DO
          PEEK TMR1H,b0                 ; Read Timer1 MSB
          IF bit6 = 0 THEN
            LOW 3
          ELSE
            HIGH 3
          END IF
        LOOP

; *****************************************************************************
; *                                                                           *
; *     End of Program                                                        *
; *                                                                           *
; *****************************************************************************
 
Top