2nd thread on site

rabag

New Member
Hi,

I am a trainee teacher and I wrote a thread a couple of weeks ago about a four digit seven segment display and the 4026 chip( I am trying to display the time). I have moved on since then and have managed to display numbers on the display using a 4511 BCD. My next step is to programme the 18x picaxe to display the time or something near to this. Any info on programming the 18x would be great, any help would be much appreciated. Also I am still unclear wether I can use the the ds1307 with the 4511 BCD. If not any suggestions.

Many thanks

ryan
 

BeanieBots

Moderator
The DS1307 is ideal for use with an 18X and real time displays.
Might be worth investing in the datalogger board to play with.
It has 18X, DS1307, EEPROM and a few LEDs and sensors.
There is also a wizard in the programming editor that will write logging code for you.
Even if you don't have the logging board, the wizard will still produce code which you can use and edit to suit.
The data in the DS1307 is BCD, so if you have a BCD display, it's a simple case of read the clock and then push the data out to the display.
 

Rickharris

Senior Member
There have been other threads discussing displaying/measuring time at various degrees of accuracy.

Obviously the 18s internal clock isn't going to be super accurate but in ptinciple will give you at least the basis for a clock, after that all you need is an accurate time base to measure.

Start with a basic time base say for simplicity a 1 second count.

Count the seconds to give minutes count the minutes to give hours display the content of the variables that you use as the time.

Code:
'untested

'B0=sec, b1=min,B2=hours

start:
Secs:
pause 1000
b0=b0+1
gosub display_time 'display the time

if b0=60 then min
goto start


min:
B0=0 'reset secs
B1=B1+1  'inc mins
if b1=60 then hrs
goto start


hrs:
B1=0 'reset mins
b2=b2+1 ' count hrs

if b2=12 then resethrs

goto start


resethrs:
b2=0
goto start

display_time:

'put your code here to drive the display with the contents of B0,B1,B2

return
A start at least.

You can read the RTC to give the time directly the data sheet gives details.
 
Top