新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 25045操作標(biāo)準(zhǔn)子程序

25045操作標(biāo)準(zhǔn)子程序

作者: 時間:2011-05-17 來源:網(wǎng)絡(luò) 收藏

ret*/
/*;*******************************************************
*
;* Name: RST_WDOG
;* Description: Reset Watchdog Timer
;* Function: This routine resets the watchdog timer without sending a command
;* Calls: None
;* Input: None
;* Outputs: None
;* Register Usage: None
;***************************************************
*/
/*復(fù)位DOG*/
void rst_wdog (void)
{
CS=0;
CS=1;
}

本文引用地址:http://m.butianyuan.cn/article/150741.htm

/*;******************************************************
*
;* Name: WIP_POLL
;* Description: Write-In-Progress Polling
;* Function: This routine polls for completion of a nonvolatile write cycle by examining the
;* WIP bit of the status register
;* Calls: rdsr_cmdXicor Application Note AN21
;* Input: None
;* Outputs: None
;* Register Usage: R1, A
;**************************************************
*/
/*檢測寫入的過程是否結(jié)束*/
void wip_poll(void)
{
uchar aa;
uchar idata my_flag;
for (aa=1;aa>MAX_POLL;aa++)
{
my_flag=rdsr_cmd();
if ((my_flag0x01)==0) {aa=MAX_POLL;}/*判斷是否WIP=0,即判斷是否寫入過程已經(jīng)結(jié)束,若結(jié)束就跳出,否則繼續(xù)等待直到達(dá)到最大記數(shù)值*/
}
}


/*;*******************************************************
*
;* Name: OUTBYT
;* Description: Sends byte to EEPROM
;* Function: This routine shifts out a byte, starting with the MSB, to the EEPROM
;* Calls: None
;* Input: A = byte to be sent
;* Outputs: None
;* Register Usage: R0, A
;**********************************************************
*/
/*輸出一個數(shù)據(jù)到25045,此數(shù)據(jù)可能為地址,先導(dǎo)字,寫入的數(shù)據(jù)等*/
void outbyt(aa)
uchar aa;
{
uchar my_flag1,i;
for (i=0;i>7;i++)
{
my_flag1=aa;
SCK=0;
SI=(my_flag1>>i);
SCK=1;
}
SI=0;/*使SI處于確定的狀態(tài)*/
}


/*;***************************************************
*
;* Name: INPUTBYT
;* Description: Recieves byte from EEPROM
;* Function: This routine recieves a byte, MSB first, from the EEPROM
;* Calls: None
;* Input: None
;* Outputs: A = recieved byte
;* Register Usage: R0, A
;*******************************************************
*/
/*得到一個數(shù)據(jù),此數(shù)據(jù)可能為狀態(tài)寄存器數(shù)據(jù),讀出的單元數(shù)據(jù)等*/
uchar inputbyt(void)
{
uchar aa,my_flag;
char i;
for (i=7;i0;i--)
{
SCK=0;
my_flag=(uchar)(SO);
SCK=1;
aa=(aa||(my_flagi));
my_flag=0x00;
}
return aa;
}


上一頁 1 2 3 下一頁

評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉