求24秒倒计时的单片机程序

来源:百度知道 编辑:UC知道 时间:2024/05/29 06:18:27
设计一个从24秒到0秒的倒记时程序~~芯片是at89c51,谁帮帮忙啊,谢谢,高分相送!!带注释的最好~~!!

<script language=JavaScript>
<!--
var now = new Date();
function currenttime()
{
var dtime = new Date("1/1/2008"); // 月/日/年/
var time =document.getElementById("time");
now.setTime(now.getTime()+100);
days = (dtime - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (dtime - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (dtime - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
if(minutesRound<=9)
minutesRound="0"+minutesRound
seconds = (dtime - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.floor(seconds);
if(secondsRound<=9)
secondsRound="0"+secondsRound
time.innerHTML = daysRound + "天" +hoursRound + "小时" + minutesRound + "分&