日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當前位置:首頁 > 單片機 > 單片機
[導讀]/******************************************************************************//*正常操作電壓為2.7~3.6V,實驗中發(fā)現(xiàn)當電壓超過4.25V后讀出的狀態(tài)字節(jié)為9A(正常 */ /*的狀態(tài)字節(jié)值為9D),并且讀寫數(shù)據(jù)均不

/******************************************************************************/

/*正常操作電壓為2.7~3.6V,實驗中發(fā)現(xiàn)當電壓超過4.25V后讀出的狀態(tài)字節(jié)為9A(正常 */
/*的狀態(tài)字節(jié)值為9D),并且讀寫數(shù)據(jù)均不準確,所以應當保證卡片的供電電壓不超過 */
/*4.25V。 */
/*SPI規(guī)范:Data is always clocked into the device on the rising edge of SCK a-*/
/* nd clocked out of the device on the falling edge of SCK.All instruction-*/
/* s,addresses and data are transferred with the most significant bit(MSB) */
/* first. */
/* 2005-06-02*/
/******************************************************************************/
#pragma optimize(5)
#i nclude
#i nclude

#define UCHAR unsigned char
#define UINT unsigned int

sbit SPI_CS = P2^0;
sbit SPI_SCK = P2^2;
sbit SPI_SO = P2^3;
sbit SPI_SI = P2^4;

unsigned char SPI_HostReadByte(void){
unsigned char i,rByte=0;

for(i=0;i<8;i++){
SPI_SCK=0;
SPI_SCK=1;

rByte<<=1;
rByte|=SPI_SO;
}
return rByte;
}
void SPI_HostWriteByte(unsigned char wByte){
unsigned char i;

for(i=0;i<8;i++){
if((wByte< else{SPI_SI=0;}

SPI_SCK=0;
SPI_SCK=1;
}
}
/******************************************************************************/
/*Status Register Format: */
/* ----------------------------------------------------------------------- */
/* | bit7 | bit6 | bit5 | bit4 | bit3 | bit2 | bit1 | bit0 | */
/* |--------|--------|--------|--------|--------|--------|--------|--------| */
/* |RDY/BUSY| COMP | 0 | 1 | 1 | 1 | X | X | */
/* ----------------------------------------------------------------------- */
/* bit7 - 忙標記,0為忙1為不忙。 */
/* 當Status Register的位0移出之后,接下來的時鐘脈沖序列將使SPI器件繼續(xù)*/
/* 將最新的狀態(tài)字節(jié)送出。 */
/* bit6 - 標記最近一次Main Memory Page和Buffer的比較結果,0相同,1不同。 */
/* bit5 */
/* bit4 */
/* bit3 */
/* bit2 - 這4位用來標記器件密度,對于AT45DB041B,這4位應該是0111,一共能標記 */
/* 16種不同密度的器件。 */
/* bit1 */
/* bit0 - 這2位暫時無效 */
/******************************************************************************/
unsigned char AT45DB041B_StatusRegisterRead(void){
unsigned char i;

SPI_CS=0;
SPI_HostWriteByte(0xd7);
i=SPI_HostReadByte();
SPI_CS=1;

return i;
}
/******************************************************************************/
/*描述: */
/* When the last bit in the main memory array has been read,the device will*/
/* continue reading back at the beginning of the first page of memory.As w-*/
/* ith crossing over page boundaries,no delays will be incurred when wrapp-*/
/* ing around from the end of the array to the beginning of the array. */
/*參數(shù): */
/* PA - 頁地址,0~2047 */
/* BFA - 指定BUFFER中的起始寫入地址 */
/* pHeader - 指定數(shù)據(jù)的首地址 */
/* len - 指定數(shù)據(jù)的長度 */
/******************************************************************************/
void AT45DB041B_ContinuousArrayRead(UINT PA,UINT BFA,unsigned char *pHeader,UINT len){
unsigned int i;

while(i++<255){if(AT45DB041B_StatusRegisterRead()&0x80){break;}}
SPI_CS=0;
SPI_HostWriteByte(0xe8);
SPI_HostWriteByte((unsigned char)(PA>>7));
SPI_HostWriteByte((unsigned char)((PA<<1)|(BFA>>8)));
SPI_HostWriteByte((unsigned char)BFA);
for(i=0;i<4;i++){SPI_HostWriteByte(0x00);}

for(i=0;i SPI_CS=1;
}
/******************************************************************************/
/*描述: */
/* 將指定數(shù)據(jù)寫入從某個地址(0~263)開始的BUFFER中。 */
/*參數(shù): */
/* buffer - 選擇BUFFER,01H選擇BUFFER 1,02H選擇BUFFER 2 */
/* 在該指令序列中,操作碼84H選擇BUFFER 1,87H選擇BUFFER 2 */
/* BFA - BUFFER中的起始地址,0~263 */
/* pHeader - 待存數(shù)據(jù)的頭指針 */
/* len - 待存數(shù)據(jù)的長度1~264 */
/******************************************************************************/
void AT45DB041B_BufferWrite(UCHAR buffer,UINT BFA,UCHAR *pHeader,UINT len){
unsigned int i;

while(i++<255){if(AT45DB041B_StatusRegisterRead()&0x80){break;}}
SPI_CS=0;
switch(buffer){
case 1:SPI_HostWriteByte(0x84);break;
case 2:SPI_HostWriteByte(0x87);break;
}
SPI_HostWriteByte(0x00);
SPI_HostWriteByte((unsigned char)(BFA>>8));
SPI_HostWriteByte((unsigned char)BFA);

for(i=0;i SPI_CS=1;
}
/******************************************************************************/
/*描述: */
/* 將指定數(shù)據(jù)寫入從某個地址(0~263)開始的頁中:包含2個動作,首先將指定數(shù)據(jù)*/
/* 寫入到BUFFER 1或者BUFFER 2中,其中可以指定BUFFER中的起始寫入地址,此寫入*/
/* 動作不影響B(tài)UFFER中其它地址中的數(shù)據(jù),然后再將BUFFER中的整個數(shù)據(jù)寫入到某指*/
/* 定頁中(帶預擦除)。 */
/*參數(shù): */
/* buffer - 選擇BUFFER,01H選擇BUFFER 1,02H選擇BUFFER 2 */
/* PA - 頁地址,0~2047 */
/* BFA - 指定BUFFER中的起始寫入地址 */
/* pHeader - 指定數(shù)據(jù)的首地址 */
/* len - 指定數(shù)據(jù)的長度 */
/******************************************************************************/
void AT45DB041B_BufferToMainMemoryPageProgramWithBuilt_inErase(UCHAR buffer,UINT PA,UINT BFA,UCHAR *pHeader,UINT len){
unsigned int i;

AT45DB041B_BufferWrite(buffer,BFA,pHeader,len);
while(i++<1000){if(AT45DB041B_StatusRegisterRead()&0x80){break;}}

SPI_CS=0;
switch(buffer){
case 1:SPI_HostWriteByte(0x83);break;
case 2:SPI_HostWriteByte(0x86);break;
}
SPI_HostWriteByte((unsigned char)(PA>>7));
SPI_HostWriteByte((unsigned char)(PA<<1));
SPI_HostWriteByte(0x00);
SPI_CS=1;
}
/******************************************************************************/
/*描述: */
/* 與上一個函數(shù)的唯一區(qū)別是不帶預擦除。 */
/******************************************************************************/
void AT45DB041B_BufferToMainMemoryPageProgramWithoutBuilt_inErase(UCHAR buffer,UINT PA,UINT BFA,UCHAR *pHeader,UINT len){
unsigned int i=0;

AT45DB041B_BufferWrite(buffer,BFA,pHeader,len);
while(i++<1000){if(AT45DB041B_StatusRegisterRead()&0x80){break;}}

SPI_CS=0;
SPI_HostWriteByte(0x88+buffer);
SPI_HostWriteByte((unsigned char)(PA>>7));
SPI_HostWriteByte((unsigned char)(PA<<1));
SPI_HostWriteByte(0x00);

for(i=0;i SPI_CS=1;
}

void main(void){
unsigned char i;
UCHAR data test[32];

i=AT45DB041B_StatusRegisterRead();

memset(test,0x77,32);
AT45DB041B_BufferToMainMemoryPageProgramWithBuilt_inErase(1,2047,0,test,32);
memset(test,0x26,32);
AT45DB041B_ContinuousArrayRead(2047,0,test,32);

memset(test,0x88,32);
AT45DB041B_BufferToMainMemoryPageProgramWithBuilt_inErase(2,2047,0,test,32);
memset(test,0x55,32);
AT45DB041B_ContinuousArrayRead(2047,0,test,32);
while(1){}
}

本站聲明: 本文章由作者或相關機構授權發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內(nèi)容真實性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權益,請及時聯(lián)系本站刪除。
換一批
延伸閱讀

Sept. 10, 2025 ---- 根據(jù)TrendForce集邦咨詢最新發(fā)布的《全球電動車逆變器市場數(shù)據(jù)》,2025年第二季受惠純電動車(BEV)銷售成長,全球電動車(注1)牽引逆變器裝機量達766萬臺,年增19%。...

關鍵字: 增程式電動車 SiC 牽引逆變器

Sept. 8, 2025 ---- 根據(jù)TrendForce集邦咨詢最新調(diào)查,2025年第二季NVIDIA(英偉達) Blackwell平臺規(guī)模化出貨,以及北美CSP業(yè)者持續(xù)擴大布局General Server(通用型...

關鍵字: SSD DDR4 服務器

Sept. 4, 2025 ---- Apple(蘋果)即將發(fā)布iPhone 17、iPhone 17 Air(暫名)、iPhone 17 Pro及Pro Max四款旗艦新機,除了外觀辨識度升級,處理器性能、散熱和拍攝功...

關鍵字: iPhone 16 A19處理器 折疊機

Sept. 3, 2025 ---- 根據(jù)TrendForce集邦咨詢最新發(fā)布的《2025近眼顯示市場趨勢與技術分析》報告,2025年隨著國際品牌陸續(xù)推出AR眼鏡原型,以及Meta預計在近期發(fā)布AR眼鏡Celeste,市...

關鍵字: AR眼鏡 OLED

Sept. 2, 2025 ---- TrendForce集邦咨詢表示,2025年第二季DRAM產(chǎn)業(yè)因一般型DRAM (Conventional DRAM)合約價上漲、出貨量顯著增長,加上HBM出貨規(guī)模擴張,整體營收為3...

關鍵字: DRAM 智能手機 ASP

Sept. 1, 2025 ---- 根據(jù)TrendForce集邦咨詢最新調(diào)查,2025年第二季因中國市場消費補貼引發(fā)的提前備貨效應,以及下半年智能手機、筆電/PC、Server新品所需帶動,整體晶圓代工產(chǎn)能利用率與出貨...

關鍵字: 晶圓代工 智能手機 筆電

Aug. 28, 2025 ---- 根據(jù)TrendForce集邦咨詢最新調(diào)查,2025年第二季NAND Flash產(chǎn)業(yè)雖面臨平均銷售價格(ASP)小幅下滑,所幸原廠減產(chǎn)策略緩解供需失衡,疊加中、美兩大市場政策推動,整體...

關鍵字: NAND Flash SSD AI

Aug. 26, 2025 ---- NVIDIA(英偉達)近日推出的Jetson Thor被視為機器人的物理智慧核心,以Blackwell GPU、128 GB記憶體堆疊出2070 FP4 TFLOPS AI算力,是前...

關鍵字: 機器人 大型語言模型 AI算力

Aug. 21, 2025 ---- 根據(jù)TrendForce集邦咨詢最新液冷產(chǎn)業(yè)研究,隨著NVIDIA GB200 NVL72機柜式服務器于2025年放量出貨,云端業(yè)者加速升級AI數(shù)據(jù)中心架構,促使液冷技術從早期試點邁...

關鍵字: AI 數(shù)據(jù)中心 服務器

除了充電電路外,鋰電池的放電過程也需要保護。鋰電池的放電電壓不能低于3.0V,否則電池壽命會大幅縮短。為了實現(xiàn)這一保護,工程師們設計了DW01芯片與8205 MOS管的電路組合。DW01芯片能夠監(jiān)控鋰電池的放電電壓和電流...

關鍵字: 鋰電池 電池
關閉