18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 10<br />

Listing 10-3 (page 4 of 4).<br />

2180 REM store alarm settings<br />

2190 IF AF1 THEN X=M : GOSUB 3000 : XBY(WT+3)=80H+X<br />

2200 IF AF2 THEN X=H : GOSUB 3000 : XBY(WT+5)=80H+X<br />

2210 IF AF=4 THEN X=D : GOSUB 3000 : XBY(WT+7)=80H+X<br />

2220 REM turn on alarm<br />

2230 REM time-of-day alarm is edge-triggered, low-going, INTA<br />

2240 XBY(WT+0BH)=0D8H<br />

2250 DO<br />

2260 ONEX1 3200<br />

2270 WHILE 1=1<br />

2280 RETURN<br />

3000 REM convert decimal to BCD<br />

3010 X=INT(X/10)*16+X-INT(X/10)*10<br />

3020 RETURN<br />

3100 REM convert BCD to decimal<br />

3110 X=INT(X/16)*10+(X/16-INT(X/16))*16<br />

3120 RETURN<br />

3200 REM alarm interrupt routine<br />

3210 PRINT “ALARM”<br />

3220 GOSUB 1000<br />

3230 RETI<br />

184 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!