新聞中心

EEPW首頁 > 模擬技術 > 設計應用 > ZipAmp中英文對照表

ZipAmp中英文對照表

作者: 時間:2011-07-23 來源:網絡 收藏

ZipAmp中英文對照表

/*********************************************
ZipAmp

Author : Nasif Akand
Copyright : (C) Nasif Akand 2003
Notice :
Copyright 2003 Nasif Akand (nasif@yifan.net)
http://go.to/zipamp
http://zipamp.virtualave.net

This file is part of ZipAmp MP3 software.

ZipAmp is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.

ZipAmp is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this code; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
這一個文件是 ZipAmp MP3 軟件的一部份。

ZipAmp 是免費的軟件;你能重新分配它及[或] 修正
它在角馬公眾執(zhí)照的術語之下當做出版被
免費的軟件基礎; 或執(zhí)照的 2 版 或
(在你的選項)任何的較遲版本。

ZipAmp 在希望中被分配它將會是有用的
但是沒有任何的擔保; 沒有更甚至被暗示的擔保
為一個特別的目的 MERCHANTABILITY 或健身。 那
為較多的細節(jié)角馬公眾執(zhí)照。

你應該要接受角馬公眾執(zhí)照的副本
連同這一個密碼一起; 如果不 寫到免費的軟件
基礎,公司, 59個寺廟地方,隨員 330 ,波士頓 文學碩士 02111-1307 美國

Chip type : AT90S8515
Clock frequency : 12.00000 MHz
Memory model : Small
Internal SRAM size : 512 bytes
External SRAM size : 0 byte
Data Stack size : 64 bytes

這個是用來設置Codevision的,按照這個設置然后添加下面所提示的包含就可以編譯了。
芯片類型 : AT90S8515
時鐘頻率 : 12.00000 MHz
內存模式 : 小的
內在的 SRAM 大小 : 512 bytes
外部 SRAM 大小 : 0 byte
數據堆棧大小 : 64 bytes

Tested ATA Drive
Samsung SpinPoint SV3064D 30 GB

Test Drive Access Time:
Track to Track : 0.8 m/s
Average : 9.0m/s
Full Stroke : 17 m/s

Test Drive Playback:
Full speed MP3 playback at 320KBps.

測試時使用的是三星的 SV3064D 30 GB 硬盤

測試硬盤的平均時間:
軌跡到軌跡 : 0.8 m/s
平均 : 9.0m/s
完全的讀取 : 17 m/s

測試硬盤重放:
使用的是編碼率高達320KBps的mp3.
*********************************************/

#define DataReq PINB.2

#include 90s8515.h> //8515 header file
#include //Codevision spi
#include "zfat.h"
#include "zata.h"
#include "ztype.h"
#include "zcontrol.h"
#include "zlcd.h"
#include //Codevision delay
#include "i2c.h"
//下面是按照Datazyb所提示而添加進的。添加這些包含后就能順利的編譯了。
//編譯好了的程序能讀取我的富士通3g的硬盤,但是出來的聲音不流暢,可能示由于硬盤太老的緣故吧。
#include "zata.c"
#include "zfat.c"
#include "ztype.c"
#include "zcontrol.c"
#include "zlcd.c"
#include "i2c.c"

// External Interrupt 0 service routine
// 外部中斷 0個服務常式
//這里說明一下,這里是按鈕輸入的反應設置,也就是說當按鈕按下zipmap要干些什么就是在這里設置的。
//情形(case)按照1,2,4,8...這樣排列是照按鍵接口ad0,ad1...來的,
interrupt [EXT_INT0] void ext_int0_isr(void)
{
unsigned char in;
#asm("cli");
in=PINC; //Read the input buttons /讀輸入按鈕
in=~in; //Invert them to see which one is high (thats the one pressed) /判斷它們是哪一個按下了。

while ((!PIND.2)); //wait until interrupt key released /等候按紐松開了才輸出

switch (in) {

//Case 1= STOP /情形 1= 停止
case 1: //play=0 is pause play=1 is play play=2 is stop
//播放=0 代表暫停 播放=1 代表播放 播放=2 代表停止

play=2; //STOP /停止
STAPlay(); //Stop player /停止播放器
UnBusy(); //Remove HD Busy light /使硬盤指示燈長亮
currentCluster=firstCluster; //Remember file start cluster /記憶文件開始群
clusterBufferReadPos=clusterBufferWritePos; //Clear cluster buffer /清除群緩沖

filePos=0; //Set filestart pos at beginning
sectorPos=0;
mp3Pos=0;
break;

//Case 2= Play or Pause /情形 2= 播放或暫停
case 2: play=(~play) 1; //Invert play. If play then pause if pause then play
//反轉播放.如果是播放就暫停,如果暫停就播放
STAPlay(); //Load command /讀取命令
break;

//Case 4=
case 4:
if (currentFileNum=1) currentFileNum=totalFiles-1;
else currentFileNum=currentFileNum-2;
dirReadOffset.fileNum=0; //To reread dir from start.

break;

case 8: currentFileNum+=advance; //FF
if (currentFileNum>totalFiles) {
currentFileNum=1;
dirReadOffset.fileNum=0;
}
break;

case 16: filePos=FileSize; //NEXT
break;

case 32: //聲音模式設置
soundMode = (soundMode+1) soundModeMask;
SetBassTreble();
break;

case 64: playMode = (playMode+1) playModeMask; //播放模式設定
break;
};

intFlag=1; //Set interrupt occured flag /設置中斷發(fā)生情況
}

/*
// External Interrupt 1 service routine / 外部中斷 1個服務常式
interrupt [EXT_INT1] void ext_int1_isr(void)
{
// Place your code here
// 把你的代碼放到這里,實際上在zipamp里這里可以不用理會,因為它的中斷1口根本就沒有接東西上去
//不過你如果想添加遙控的話,把代碼放到這里是再合適不過的了。
printf("Entered Interrupt 2");
} */


// Declare your global variables here
//全局變量在這里

void main(void)
{
// Declare your local variables here
byte temp; dword extension;

//這些設置要結合硬件電路圖才能看得明白。
// Input/Output Ports initialization /設定輸入輸出口初始值。
// Port A /PA口
DDRA=0x00; //Start as Input port /開始為輸入口
PORTA=0x00; //Set to High-Z state /設定為高阻狀態(tài)

// Port B /PA口
DDRB=0xBB;
PORTB=0x0B; //Enable Reset for STA013 Disable ATA IOR and IOW. /允許重啟STA013 禁止ATA IOR與IOW.

// Port C /PA口
DDRC=0xFF; //Output port /輸出口
PORTC=0x00; //Set 0 /設定 0

// Port D /PA口
DDRD=0xF2;
PORTD=0x20; //Disable Latch and Buffer. Never pull PORTD.1 high that will cause damage to STA013
//使門電路和緩沖器失去能力。千萬別拉高“PORTD.1”(這里注釋可能有誤,應該為PORTD.0)那樣做會損壞到STA013

//這些設置要結合90s8515的說明書才會明白
// Timer/Counter 0 initialization / 定時/計數器0初始值設定
// Clock source: System Clock / 時鐘來源: 系統(tǒng)時鐘
// Clock value: Timer 0 Stopped / 時鐘值: 時鐘0停止
// Mode: Output Compare / 模式: 輸出比較
// OC0 output: Disconnected / OC0 輸出: 分離
TCCR0=0x00;
TCNT0=0x00;

// Timer/Counter 1 initialization / 定時/計數器1初始值設定
// Clock source: System Clock / 時鐘來源: 系統(tǒng)時鐘
// Clock value: 14318.180 kHz / 時鐘值: 14318.180 kHz
// Mode: Output Compare / 模式: 輸出比較
// OC1A output: Discon. / OC1A 輸出: 不精讀.
// OC1B output: Discon. / OC1B 輸出: 不精讀.
// Noise Canceler: Off / 噪音取消: 關
// Input Capture on Falling Edge / 輸入取下下降沿
TCCR1A=0x00;
TCCR1B=0x01;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// External Interrupt(s) initialization /設定外部(s)初始值
// INT0: On /INT0: 開
// INT0 Mode: Low level /INT0 模式: 低電平有效
// INT1: On /INT1: 開
// INT1 Mode: Low level /INT1 模式: 低電平有效
GIMSK=0x40;
MCUCR=0x00;
GIFR=0x40;


// Timer(s)/Counter(s) Interrupt(s) initialization /設定定時(s)/計數器(s)中斷(s)初始值
TIMSK=0x00;

// UART initialization /串口初始值設定
// Communication Parameters: 8 Data 1 Stop No Parity /溝通叁數: 8 數據 1 沒有同等
// UART Receiver: Off /串口接收器(rx):開
// UART Transmitter: On /串口發(fā)射器(tx):關


// UART Baud rate: 19200 at 14.3181 /串口通訊波特率: 19200到14.3181之間
UCR=0x08;
UBRR=0x2E;


// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;

// SPI initialization
// SPI Type: Master
// SPI Clock Rate: 2460.000 kHz
// SPI Clock Phase: Cycle Half
// SPI Clock Polarity: Low
// SPI Data Order: MSB First
// SPI 初始值設定
// SPI 類型: Master
// SPI 時鐘頻率: 2460.000 kHz
// SPI 時鐘周期: 一半
// SPI 時鐘極性: 低
// SPI 數據次序: MSB第一
SPCR=0x50;

#asm("cli");

//好了,設置好8515各個端口的初始之后,我們要開始干正事了,先初始化lcd屏,然后延時3000ms,這是為了在
//屏上顯示logo
InitLCD();
delay_ms(3000);
//DDRC=0x00;
//PORTC=0x00;

//接下來就初始話ata與fta
ATA_Init();
InitFAT();

currentFileNum=0;
temp=0;

//Find two required files in root dir ZIPAMP.SYS and ZIPAMP.CFG and save their LBA address
//查找兩個必須的文件ZIPAMP.SYS和ZIPAMP.CFG并保存它們的LBA地址
while ((temp2)(getDirEntry(0)==1)) {
extension = (*(dword *)fileExtension) 0x00FFFFFF;
//low-case z "logic AND" up-case Z =will equal up-case Z. Thus following checks for both 'z' and 'Z'
//通過邏輯或來檢測zipamp文件的存在
if ((fileName[0] 0x5A)==0x5A) { //if the name starts with Z then see if it is SYS or CFG file
//如果有文件名字為zipamp那么檢查它是否為SYS或CFG文件
if (extension==0x00535953) { dirStackLBA=clust2LBA(currentCluster); temp++; } //ZIPAMP.SYS Stack file address
// 如果是ZIPAMP.SYS文件則保存文件地址
if (extension==0x00474643) { cfgFileLBA=clust2LBA(currentCluster); temp++; } //ZIPAMP.CFG Config file address
// 如果是ZIPAMP.CFG文件則保存文件地址,這里不知是否有錯,cfg文件名轉換成bin碼應該為0x00434647
}
}

if (temp2) Halt(4); //Missing SYS or CFG file. /如果找不到SYS或CFG文件則停止并顯示錯誤.

STA013Setup(); //Setup STA013 decoder. /裝載STA013解碼器.

currentFileNum=0;
if (loadConfig()!=1) {//goto LOADED; /轉到裝載;
while (getDirEntry(1)==1) { //count # of MP3 files. /計數MP3文件.
totalFiles++;
gotoxy(3 0
writeNumber(totalFiles); //這里要用到數字輸出,因為統(tǒng)計出來的數字是16進制的,所以需要通過數字輸出
//將其轉換成10進制的顯示在屏幕上面。
}
}

//gotoxy(3 0
writestring(" Wait.."); //顯示等待種,如果是中文屏的話,這里可以輸入中文字

dirReadOffset.fileNum=0;
SetSoundCg(); //Load Sound Mode character bars into LCD CGRAM. /載如聲音模式特性圖形到LCD CGRAM.
play=1; //ZipAmp will start playing after boot finish. /ZipAmp會在啟動完畢后開始播放.
SetBassTreble(); //Setup Bass Treble registers in STA013. /裝備低音使 STA013 的寄存器增為三倍
SongSelect();
while (1) { //Main loop /主體循環(huán)

key=1;
if (key==0) key=1;
PORTC=~key;
DDRC=key;
#asm("sei");

//下面這段還不是太清楚,暫時不進行翻譯。
//Following "if" is True when INTR in NEXT FF PREV occurs. filePos and FileSize is set equal there.
//In first iteration filePos will be greater than FileSize because STA013.BIN has been read to the finish
//thus this becomes true.
if (filePos>=FileSize) SongSelect(); //Song is selected when playing finished or NEXT/PREV button pressed
///當歌曲在播放的時候被按下了NEXT或PREV按紐時
if (intFlag) { //Interrupt occured and LCD display wasn't fixed fix it.
intFlag=0;
printInfo();
}

while ((DataReq)(filePos if (mp3Pos==0) read();
spi(sectorBuffer.data[mp3Pos++]);
spi(sectorBuffer.data[mp3Pos++]);
}

//If finished reading one cluster and head hasn't been moved
if ((sectorPos==Sectors_Per_Cluster) (headMoved==0)) {

//if we have buffered next cluster then move head
if (readClusterBuffer()==1) ATA_Move_Head(clust2LBA(currentCluster));


else { //we didn't buffer it so find next cluster and move head
currentCluster=findNextCluster();
ATA_Move_Head(clust2LBA(currentCluster)); //Move head to read position
}
//Reset all parameters /重新安排全部數
sectorPos=0;
readPos=0;
headMoved=1;
}

//if we have already moved head then we can buffer next clusters
else if ((readPos|DataReq)==0) {
//check if datareq is set if set then get out of buffering
temp=sectorPos;
if (writeClusterBuffer()==1) { //if buffering was successful then move head to original location.
sectorPos=temp;
ATA_Move_Head(clust2LBA(currentCluster)+sectorPos); //move head to the current reading cluster.
headMoved=1;
readPos=0;
}
}

} // end of main loop /主體循環(huán)結束


} //END. /結束.

i2c.c
/*
Copyright 2003 Nasif Akand (nasif@yifan.net)
http://go.to/zipamp
http://zipamp.virtualave.net

This file is part of ZipAmp MP3 software.

ZipAmp is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.

ZipAmp is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this code; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
這一個文件是 ZipAmp MP3 軟件的一部份。

ZipAmp 是免費的軟件;你能重新分配它及[或] 修正
它在角馬公眾執(zhí)照的術語之下當做出版被
免費的軟件基礎; 或執(zhí)照的 2 版 或
(在你的選項)任何的較遲版本。

ZipAmp 在希望中被分配它將會是有用的
但是沒有任何的擔保; 沒有更甚至被暗示的擔保
為一個特別的目的 MERCHANTABILITY 或健身。 那
為較多的細節(jié)角馬公眾執(zhí)照。

你應該要接受角馬公眾執(zhí)照的副本
連同這一個密碼一起; 如果不 寫到免費的軟件
基礎,公司, 59個寺廟地方,隨員 330 ,波士頓 文學碩士 02111-1307 美國

*/

//This module performs I2C operations for ZipAmp /這是zipamp的i2c程序組件
//Nasif Akand

//If using CodeVision then following includes aren't needed. /如果使用 CodeVision 不需要包括下列各項
//#include "zcontrol.h"
//#include "zfat.h"
//#include "zata.h"
//#include "ztype.h"
#include "i2c.h"
//#include "" //CodeVision AVR internal delay routines /CodeVision AVR 內在的延遲常式

//I2C implementation for STA013 通過i2c控制sta013

//Port D bit 7 (pin 17) is SDA output while bit 0 (pin 10) is input Pin 16 is SCL
//SDA input is always at HighZ state. If this pin is pulled up or output high STA013 will be damaged.
//這里是定意的i2c sda數據的輸入輸出口,輸出為17腳,輸入為10腳,時鐘信號scl為16腳。

#define SDA PORTD.7
#define SCL PORTD.6
#define SDAIn PIND.0
#define Out DDRD.7=1
#define In DDRD.7=0

#define qDelay delay_us(3) //According to Phillips I2C specs in all modes.. /這里是按照菲利普i2c總線模式寫的
#define delay delay_us(3) //..max I2C delay can be 5 micro seconds. /最大 I2C 延遲可能是 5個微秒。
#define Read 0x87 //STA013 I2C Read address /STA013 I2C 讀取地址
#define Write 0x86 //STA013 I2C Write Address /STA013 I2C 寫入地址

//下面這段函數是復位sta013
void STA013Reset() {
DDRB.3=1; //Set bit3 to Output mode /設置pb3為輸出狀態(tài)
PORTB.3=0; //Set to 0 for reset /這里可以參看原理圖就明白。pb3是連在sta013的26腳/reset上的.
delay_ms(500); //Wait
PORTB.3=1; //Set to 1
delay_ms(500); //Wait
}


//下面這段數據類型聲明是用來測試i2c是否有正確應答,如果有就輸出0則表示成功
unsigned char wait_Ack (void) {
//returns 1 if ACK was 0 (meaning transfer was successful). In I2C ACK=0 means success.

unsigned char t=1;
delay;

// Take clock high
SCL=1;
delay;

// Test of ACK
delay;
if (PIND.0) { /*test of SDA level if high -> problem*/
t=0;
}

delay;
if (PIND.0) { /*test of SDA level if high -> problem*/
t=0;
}

// Take clock back low
delay;
SCL=0;
delay;

return t;
}



//數據聲明,聲明i2c的閱讀地址 adr為地址的縮寫
unsigned char i2cReadAddress(unsigned char adr) {
//Returns data read from register given in adr./從寄存器中讀取數據后返回
//In most cases we don't have to worry about it. If we don't get ACK try 10 times before giving up.
//在大部分的情況下,我們不需要為它擔憂,在拿不到正確的應答之前要嘗試十次。
unsigned char data try=0 ack;
do {
i2cStart(); //I2c start /i2c開始
ack=i2cSend(Write); //Send i2c write address /發(fā)送i2c寫入地址
ack =i2cSend(adr); //Send register address /發(fā)送記錄地址
i2cStart(); //i2c re-start
delay; //wait
ack = i2cSend(Read); //Send i2c read address
data=i2cReceive(0); //Receive data without sending ACK
i2cStop(); //Stop
try++;
}
while ((ack==0)(try10)); //try 10 times if failed /嘗試10次后返回

return data;
}

//數據聲明,聲明i2c的寫入地址。這段和上面一段類似只不過由讀變成了寫
unsigned char i2cWriteAddress(unsigned char adr unsigned char data) {
// Writes data to register adr.
//Returns 1 on successful write tries 10 times before giving up.

unsigned char ack try=0;
do {
i2cStart(); //Start
ack = i2cSend(Write); //Send i2c write address
ack = i2cSend(adr); //Send register address
delay; //wait
ack = i2cSend(data); //Send data
i2cStop(); //Stop
try++;
}
while ((ack==0)(try10)); //give up after 10 tries
return ack;
}

//這段函數是初始化i2c
void i2cInit() {
DDRD.7=1; //Set to output mode for SDA
DDRD.6=1; //Set to output mode for SCL
}

//下面這段函數是i2c開始的必要條件
void i2cStart() {
//I2C start condition.

DDRD.7=1; //SDA output mode
SDA=1;
delay;
SCL=1;
delay;
SDA=0;
delay;
SCL=0;
}

//數據聲明,發(fā)送i2c數據到sta013后返回,成功為1,失敗為0,這里發(fā)送的字節(jié)不大,一次為8個2進制數據,也就是1bit
unsigned char i2cSend(unsigned char value){
//Sends byte value and returs ACK from STA013 1=Success 0=Fail

unsigned char i;
DDRD.7=1;
for (i=0; i8; i++) {
DDRD.7=1;
if (((value >> (7-i)) 0x01)==0x01) SDA=1; //Send bit by bit
else SDA=0;
SCL=1;
delay;
SCL=0;
DDRD.7=1;
SDA=1;
delay;
}
delay;
i=wait_Ack();
return i;
}


//數據聲明,和上面的聲明類似,不過變成了接收。
unsigned char i2cReceive(unsigned char ack) {
//Receives data byte. Sends back acknoledge if ack is true

unsigned char value=0 i;
DDRD.7=1;
SDA=1;
for (i=0; i8; i++) {
delay;
SCL=1;
delay;
value = (value 1) + PIND.0; //leftshift previous value and add one more bit that's read
delay;
SCL=0;
}
if (ack) { //send ack if requested
DDRD.7=1;
SDA=0;
delay;
SCL=1;
delay;
SCL=0;
}
return value;
}

//此函數是i2c停止的條件
void i2cStop(){
//I2C stop condition.

delay;
DDRD.7=1; //SDA output mode
SDA=0;
delay;
SCL=1;
delay;
SDA=1;
delay;
}

i2c.h
/*
Copyright 2003 Nasif Akand (nasif@yifan.net)
http://go.to/zipamp
http://zipamp.virtualave.net

This file is part of ZipAmp MP3 software.

ZipAmp is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.

ZipAmp is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this code; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
這一個文件是 ZipAmp MP3 軟件的一部份。

ZipAmp 是免費的軟件;你能重新分配它及[或] 修正
它在角馬公眾執(zhí)照的術語之下當做出版被
免費的軟件基礎; 或執(zhí)照的 2 版 或
(在你的選項)任何的較遲版本。

ZipAmp 在希望中被分配它將會是有用的
但是沒有任何的擔保; 沒有更甚至被暗示的擔保
為一個特別的目的 MERCHANTABILITY 或健身。 那
為較多的細節(jié)角馬公眾執(zhí)照。

你應該要接受角馬公眾執(zhí)照的副本
連同這一個密碼一起; 如果不 寫到免費的軟件
基礎,公司, 59個寺廟地方,隨員 330 ,波士頓 文學碩士 02111-1307 美國
*/

//This module performs I2C operations for ZipAmp /這是zipamp的i2c程序組件
//Nasif Akand

//I2C implementation for STA013 /用i2c來操控sta013

#ifndef __I2C_H__
#define __I2C_H__

unsigned char wait_Ack (void);
unsigned char i2cReadAddress(unsigned char adr);
unsigned char i2cWriteAddress(unsigned char adr unsigned char data);
void i2cInit();
void i2cStart();
unsigned char i2cSend(unsigned char value);
unsigned char i2cReceive(unsigned char ack);
void i2cStop();
void STA013Reset();

#endif

塵埃粒子計數器相關文章:塵埃粒子計數器原理


評論


相關推薦

技術專區(qū)

關閉