單片機訪問外部RAM原程序
#define base_Adr 0x060000
//-----------------------定義地址指針,指向基址--------------------------------------------------------
unsigned char xdata *ORAM_base_Adr = base_Adr;
//------------------------------------------------------------------------------------------------------
// 函數(shù)名稱 ORAM_write
// 入口函數(shù) SJAREG_ADR,setting
// 出口函數(shù) 無
// 函數(shù)功能 寫外部數(shù)據(jù)存儲區(qū)
//------------------------------------------------------------------------------------------------------
void ORAM_write(unsigned char ORAM _ADR, unsigned char setting)
{
*( ORAM _base_Adr+ ORAM _ADR)=setting;
}
//------------------------------------------------------------------------------------------------------
// 函數(shù)名稱 ORAM _read
// 入口函數(shù) ORAM _ADR
// 出口函數(shù) ORAM _data
//函數(shù)功能 讀外部數(shù)據(jù)存儲區(qū)
//------------------------------------------------------------------------------------------------------
unsigned char ORAM _read(unsigned char ORAM _ADR)
{
unsigned char ORAM _data;
ORAM _data=*( ORAM _base_Adr+ ORAM _ADR);
return(ORAM _data);
}
評論