This is for a DS1337C but it might give you an idea...
Routine to set the RTC:
Code:
<font color="#0000FF"><b>SET_RTC</b></font>:
<font color="#0000FF"><b>yr </b></font>= <font color="#800000"><b>$09
</b></font><font color="#0000FF"><b>mon </b></font>= <font color="#800000"><b>$03
</b></font><font color="#0000FF"><b>date </b></font>= <font color="#800000"><b>$07
</b></font><font color="#0000FF"><b>sec </b></font>= <font color="#800000"><b>$00
</b></font><font color="#0000FF"><b>mins </b></font>= <font color="#800000"><b>$28
</b></font><font color="#0000FF"><b>hr </b></font>= <font color="#800000"><b>$05
</b></font><font color="#FF0000"><b>I2CWRITE </b></font><font color="#0000FF"><b>DS_SDA</b></font>, <font color="#0000FF"><b>DS_SCL</b></font>, <font color="#0000FF"><b>RTC</b></font>, <font color="#0000FF"><b>SecReg</b></font>, [<font color="#0000FF"><b>sec</b></font>,<font color="#0000FF"><b>mins</b></font>,<font color="#0000FF"><b>hr</b></font>,<font color="#0000FF"><b>day</b></font>,<font color="#0000FF"><b>date</b></font>,<font color="#0000FF"><b>mon</b></font>,<font color="#0000FF"><b>yr</b></font>]
<font color="#FF0000"><b>RETURN
</b></font>
To READ and send to terminal:
Code:
<font color="#FF0000"><b>I2CREAD </b></font><font color="#0000FF"><b>DS_SDA</b></font>, <font color="#0000FF"><b>DS_SCL</b></font>, <font color="#0000FF"><b>RTC</b></font>, <font color="#0000FF"><b>SecReg</b></font>, [<font color="#0000FF"><b>sec</b></font>,<font color="#0000FF"><b>MINs</b></font>,<font color="#0000FF"><b>hr</b></font>,<font color="#0000FF"><b>day</b></font>,<font color="#0000FF"><b>date</b></font>,<font color="#0000FF"><b>mon</b></font>,<font color="#0000FF"><b>yr</b></font>]
<font color="#FF0000"><b>PAUSE </b></font><font color="#800000"><b>100
</b></font><font color="#FF0000"><b>SEROUT2 </b></font><font color="#0000FF"><b>PORTC</b></font>.<font color="#800000"><b>6</b></font>, <font color="#800000"><b>16572</b></font>, [ <b>"TIME "</b>, <font color="#FF0000"><b>HEX2 </b></font><font color="#0000FF"><b>hr</b></font>, <b>":"</b>, <font color="#FF0000"><b>HEX2 </b></font><font color="#0000FF"><b>MINs</b></font>, <b>":"</b>,<font color="#FF0000"><b>HEX2 </b></font><font color="#0000FF"><b>sec</b></font>,<font color="#800000"><b>$d</b></font>, <font color="#800000"><b>$a</b></font>]
<font color="#FF0000"><b>SEROUT2 </b></font><font color="#0000FF"><b>PORTC</b></font>.<font color="#800000"><b>6</b></font>, <font color="#800000"><b>16572</b></font>, [ <b>"DATE "</b>, <font color="#FF0000"><b>HEX2 </b></font><font color="#0000FF"><b>mon</b></font>,<b>"-"</b>,<font color="#FF0000"><b>HEX2 </b></font><font color="#0000FF"><b>date</b></font>,<b>"-"</b>,<font color="#FF0000"><b>HEX2 </b></font><font color="#0000FF"><b>yr</b></font>,<font color="#800000"><b>$d</b></font>, <font color="#800000"><b>$a</b></font>]
Bookmarks