@ Art
Thanks a million for the reply.
I had already checked out code by Cocacolakid as well as Sayzer and quite a few others, as well as Melanie's example MN1307.txt, with little or no success.
The code from Cocacolakid uses the shiftin/out method not so ?
This is the reason why I asked about the TRIS statement.
Check the first few lines of Cocolakid's code:
Code:
'-------------------------- Clock Variables ---------------------------------
rst var portb.2 ' DS1302 Reset Pin
clk var portb.1 ' DS1302 Clock Pin
dq var portb.0 ' DS1302 Data Pin
What should the TRIS statement be ? Or is this handled by the SHIFTIN/OUT statement ?
Later on in his code there is :
Code:
'------------------------ Initial Settings For Ports ------------------------
low rst ' Set reset pin low
low clk ' Set clock pin low
trisb = 0
trisa = 0
The forum is scattered with many examples for DS1302 and DS1307 and various timers, clocks elapsed timers, olympic clocks and there are even examples for the various LABX boards,even some methods to use a PIC as a timer with accuracy much like that of a DS1302/7 depending on the crystal you choose.
With the wealth of information here it starts becoming rather difficult to figure out which clock chip is a good selection and why.
From what I can see (and I may well be wrong),
if you're using the DS1302 then you should use a shiftin/out method and
if you're using a DS1307 you should use the I2C method.
I am trying to build a very simple alarm clock which triggers on a matching date and time. It will also be used as a datalogger for logging the time and duration of power failures for my generator since we have many power failures in our area at some really odd times.
Your info has been most useful in starting to figure out some parts of this puzzle.
Any more info you or anyone else would also be most welcome.
Kind regards
Dennis
Bookmarks