新闻中心

EEPW首页 > 嵌入式系统 > 设计应用 > 25045操作标准子程序

25045操作标准子程序

作者:时间:2011-05-17来源:网络收藏

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
;***************************************************
*/
/*复位DOG*/
void rst_wdog (void)
{
CS=0;
CS=1;
}

本文引用地址:http://www.eepw.com.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
;**************************************************
*/
/*检测写入的过程是否结束*/
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,即判断是否写入过程已经结束,若结束就跳出,否则继续等待直到达到最大记数值*/
}
}


/*;*******************************************************
*
;* 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
;**********************************************************
*/
/*输出一个数据到25045,此数据可能为地址,先导字,写入的数据等*/
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处于确定的状态*/
}


/*;***************************************************
*
;* 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
;*******************************************************
*/
/*得到一个数据,此数据可能为状态寄存器数据,读出的单元数据等*/
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 下一页

关键词: 子程序 标准 操作

评论


相关推荐

技术专区

关闭