索引數(shù)據(jù)地址

您好: 我用的是新華龍的F340的單片機(jī),數(shù)據(jù)線接的P3口,片選信號(hào)線接P0.6,A0接P0.7,那么在程序起先CH375HM_INDEX和CH375HM_DATA分別應(yīng)該定義多少呢,還有想弱弱的問一下,想暫時(shí)調(diào)試看結(jié)果的話除了這個(gè)改動(dòng)外,別的相對(duì)于例子程序外沒有什么改的吧

1.模塊上的RD,WR,A0,CS,數(shù)據(jù)線要是直接掛在單片機(jī)總線上,根據(jù)A0,CS計(jì)算下總線地址.A0=0索引端口,A0=1數(shù)據(jù)端口.要不是掛在總線上,就不用計(jì)算這個(gè)地址,直接用模擬I/O口進(jìn)行讀寫操做, 2.只要根據(jù)你的單片機(jī)改下硬件定義,中斷腳和三個(gè)讀寫子函數(shù)就可以了.


請(qǐng)問“直接用模擬I/O口進(jìn)行讀寫操做”,不明白啊


就是根據(jù)時(shí)序要求,直接對(duì)這些I/O口進(jìn)行操作,例如: void CH375HM_INDEX_WR ( unsigned char Index) { CH375HM_D0_D7 = Index; CH375HM_A0 = 0; CH375HM_DATA_DIR_OUT( ); /* 設(shè)置并口方向?yàn)檩敵?*/ CH375HM_RD = 1; 如果I/O默認(rèn)電平是高電平,那么這是可選操作 CH375HM_CS = 0; CH375HM_WR = 0;

CH375HM_CS =0; //對(duì)于高速單片機(jī),該指令用于延時(shí),以便向CH375_WR產(chǎn)生寬度至少為80nS的低電平脈沖

CH375HM_WR = 1; CH375HM_CS = 1; CH375HM_A0 = 1; CH375HM_DATA_DIR_IN( ); /* 禁止數(shù)據(jù)輸出 */

}

void CH375HM_DATA_WR (unsigned char dat ) { CH375HM_D0_D7 = dat; CH375HM_DATA_DIR_OUT( ); CH375HM_A0 = 1; CH375HM_CS = 0; CH375HM_WR = 0;

CH375HM_CS = 0; // 對(duì)于高速單片機(jī),該指令用于延時(shí),以便向CH375_WR產(chǎn)生寬度至少為80nS的低電平脈沖

CH375HM_WR = 1; CH375HM_CS = 1; CH375HM_DATA_DIR_IN( ); /* 禁止數(shù)據(jù)輸出 */ }

unsigned char CH375HM_DATA_RD( void ) {

unsigned char dat; CH375HM_DATA_DIR_IN(); CH375HM_A0 = 1; CH375HM_CS = 0; CH375HM_RD = 0;

CH375HM_CS=0; //對(duì)于高速單片機(jī),該指令用于延時(shí),以便向CH375_RD產(chǎn)生寬度至少為80nS的低電平脈沖

dat = CH375HM_D0_D7 CH375HM_CS = 1; CH375HM_A0 = 0; return( dat );

}


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频