📄 源程序.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>阅读帖子</title>
</head>
<body>
<IFRAME id=wFrameSpamReport name=wFrameSpamReport width=0 height=0>
</IFRAME>
<table cellSpacing="0" cellPadding="0" width="100%" align="center">
<tbody>
<tr>
<td align="middle"><img height="4" src="blank.gif" width="1" border="0"><br>
</td>
</tr>
</tbody>
</table>
<script language src="http://www.21icbbs.com/club/bbs/js/dcookie.js"></script>
<script>
var maxLenth=60;
function showTitle(str){
document.write((str.length>(maxLenth+35)?str.substr(0,(maxLenth+35)-1)+"...":str))
}
function showRelateTopic(){
document.write((str.length>maxLenth?str.substr(0,maxLenth-1)+"...":str))
}
</script>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tbody>
<tr>
<td class="text9" vAlign="top" width="100%"><img height="1" src="blank.gif" width="190"><br>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
<tbody>
<tr>
<td class="pagehead" noWrap>阅读帖子</td>
</tr>
</tbody>
</table>
<img height="5" src="blank.gif" width="1"><br>
</td>
</tr>
</tbody>
</table>
<table cellSpacing="2" cellPadding="1" width="100%">
<tbody>
<tr>
<td bgColor="#003399"><font color="white">既然有人需要,我还是把源程序贴出来吧,仅供参考</font></td>
</tr>
<tr>
<td bgColor="#e6f4ff"><img src="mood24.gif" align="absMiddle" width="20" height="20"> computer00
发表于 2005-3-28 19:54 <font color="#336699"><strong>DVB与视音频</strong></font>
<a href="http://www.21icbbs.com/club/bbs/list.asp?boardid=25"><font color="red">←返回版面</font></a>
<a href="http://www.21icbbs.com/club/bbs/queryInfo.asp?key=fEf9%2F99FpQpoPjT%2DBo%2D3O%216Vf%2FC%21dQTCft5ffH5520fKt%5FO%2DW%5F5EeXeOTLfg&txtname=computer00" target="_blank"><img alt="按此察看该网友的资料" src="profile.gif" border="0" width="22" height="11"></a>
<a href="http://www.21icbbs.com/club/bbs/info/addToBookMark.asp?type=announce&boardID=25&id=1586082&topic=%BC%C8%C8%BB%D3%D0%C8%CB%D0%E8%D2%AA%A3%AC%CE%D2%BB%B9%CA%C7%B0%D1%D4%B4%B3%CC%D0%F2%CC%F9%B3%F6%C0%B4%B0%C9%A3%AC%BD%F6%B9%A9%B2%CE%BF%BC&author=computer00"><img alt="按此把文章加入收藏夹" src="fav.gif" border="0" width="15" height="11"></a>
<a href="http://www.21icbbs.com/club/bbs/ownerEditAnnounce.asp?v=&id=1586082"><img alt="按此编辑本帖" src="edit.gif" border="0" width="18" height="13"></a></td>
</tr>
<tr>
<td bgColor="#e6f4ff"><br>
<table cellSpacing="1" cellPadding="3" width="95%" align="center">
<tbody>
<tr>
<td style="FONT-SIZE: 12px; LINE-HEIGHT: 18px">/************************************************************************************<br>
本程序仅供广大电子爱好者制作MP3学习和参考使用,不得用于其它用途,否则后果自负<br>
<br>
AT89C51SND1C 解码芯片做的硬盘MP3,软件还在完善中,现在只支持一块硬盘,一个分区,<br>
只支持根目录歌曲播放,不支持文件夹。只支持FAT32文件系统,部分MP3文件不能解码。<br>
*************************************************************************************/<br>
<br>
<br>
/* MAIN.C File<br>
The MP3 main file<br>
Created by Computer-lov date: 2005.3.19<br>
Copyright (c) 2005 Computer-lov<br>
version 1.0<br>
*/<br>
<br>
#include "AT89C51SND1C.H"<br>
#include "ide.h"<br>
#include "hardware.h"<br>
#include "file_system.h"<br>
#include "Initial.h"<br>
#include "keyboard.h"<br>
#include "MP3.H"<br>
<br>
//////////////////////////////////////////// 主函数 ///////////////////////////////<br>
void main(void)<br>
{<br>
system_initial(); //初始化<br>
status=START;<br>
driver_number=0; //选择第一个分区<br>
key=0;<br>
function=FUN_SEL; //歌曲选择状态<br>
while(1)<br>
{<br>
switch (status)<br>
{<br>
case START: //开机<br>
{<br>
vol=10;<br>
bas=10;<br>
med=10;<br>
tre=10;<br>
set_vol(vol);<br>
set_vor(vol);<br>
set_bas(bas);<br>
set_med(med);<br>
set_tre(tre); //音量等初始化<br>
while(!key);<br>
if(key==KEY_OK)<br>
{<br>
status=PLAY;<br>
key=0;<br>
break;<br>
}<br>
<br>
}<br>
case STOP:{ //停止<br>
while(!key);<br>
if(key==KEY_OK)<br>
{<br>
status=PLAY;<br>
key=0;<br>
break;<br>
}<br>
}<br>
<br>
case PLAY:{play();break;} //播放<br>
case USB: {break;} //USB下载<br>
key=0;<br>
}<br>
}<br>
}<br>
/////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
/* IDE.C File<br>
Created by Computer-lov Date: 2005.3.19<br>
Copyright (c) 2005 Computer-lov<br>
version 1.0<br>
*/<br>
<br>
#include "AT89C51SND1C.h"<br>
#include "file_system.h"<br>
#include "IDE.H"<br>
#include "hardware.h"<br>
<br>
unsigned char DISK_CAPACITY[8];<br>
//unsigned char IDE_Buffer_H,IDE_Buffer_L;<br>
unsigned char driver_number=0; //磁盘驱动器<br>
<br>
////////////////////////////////////// IDE
状态寄存器 ////////////////////////////////////<br>
unsigned char bdata IDE_status;<br>
sbit IDE_BSY = IDE_status^7;<br>
sbit IDE_DRDY = IDE_status^6;<br>
sbit IDE_DWF = IDE_status^5;<br>
sbit IDE_DSC = IDE_status^4;<br>
sbit IDE_DRQ = IDE_status^3;<br>
sbit IDE_CORR = IDE_status^2;<br>
sbit IDE_IDX = IDE_status^1;<br>
sbit IDE_ERR = IDE_status^0;<br>
//////////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
////////////////////////////////////// IDE
错误寄存器 ////////////////////////////////////<br>
unsigned char bdata IDE_error_register;<br>
sbit IDE_BBK = IDE_error_register^7;<br>
sbit IDE_UNC = IDE_error_register^6;<br>
sbit IDE_MC = IDE_error_register^5;<br>
sbit IDE_IDNF = IDE_error_register^4;<br>
sbit IDE_MCR = IDE_error_register^3;<br>
sbit IDE_ABRT = IDE_error_register^2;<br>
sbit IDE_TKONF= IDE_error_register^1;<br>
sbit IDE_AMNF = IDE_error_register^0;<br>
//////////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
//////////////////////////////////////////////////////////////////////////////////////////////<br>
void delayXms(unsigned int x) //延时x毫秒,时间不准的<br>
{<br>
unsigned int i;<br>
for(;x>0;x--)<br>
for(i=0;i<500;i++);<br>
}<br>
//////////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
///////////////////////////////// IDE 复位 ///////////////////////////////////////////////<br>
void reset_IDE(void)<br>
{<br>
IDE_Address=IDE_Reset;<br>
IDE_ALE=1;<br>
IDE_ALE=0;<br>
delayXms(200);<br>
IDE_Address=IDE_Bus_Not_Use;<br>
IDE_ALE=1;<br>
IDE_ALE=0;<br>
delayXms(200);<br>
while(!IDE_IORDY);<br>
}<br>
///////////////////////////////////////////////////////////////////////////////////////////////<br>
<br>
///////////////////////////////////// 读IDE 16位,未用 ////////////////////////////////////////<br>
/*void read_IDE_16(unsigned char address)<br>
{<br>
while(!IDE_IORDY);<br>
IDE_Address=address;<br>
set_IDE_address();<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -