新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 利用2051單片機燒錄24C02,04,08,16

利用2051單片機燒錄24C02,04,08,16

作者: 時間:2016-11-30 來源:網(wǎng)絡(luò) 收藏
A2: CLR P1.7SETB P3.7JB P1.6,$LCALL M001JNB P1.6,$SETB P1.7MOV 39H,#0A0H;寫第一頁MOV 38H,#0A1H;讀第一頁MOV 37H,#1;總頁數(shù)A3: JB P1.5,A4JB P1.4,A01MOV 37H,#1;00---C02JMP A02A01: MOV 37H,#2;01---C04JMP A02A4: JB P1.4,A5MOV 37H,#4;10---C08JMP A02A5: MOV 37H,#8;11---C16A02:X24C021:MOV 40H,#0;位置MOV 43H,#0FFH;一頁總數(shù)X24C022:LCALL R24C02;MOV 41H,32H;CALL W24C02INC 40HDJNZ 43H,X24C022MOV 40H,#0;位置MOV 43H,#0FFH;一頁總數(shù)INC 39HINC 39HINC 38HINC 38HDJNZ 37H,X24C022MOV 39H,#0A0H;寫第一頁MOV 38H,#0A1H;讀第一頁MOV 37H,#1;總頁數(shù)D24C021:MOV 40H,#0;位置MOV 43H,#0FFH;一頁總數(shù)D24C022:LCALL R24C02;MOV 41H,32H;CALL R24C02_1MOV A,32HCJNE A,41H,D24C023INC 40HDJNZ 43H,D24C022MOV 40H,#0;位置MOV 43H,#0FFH;一頁總數(shù)INC 39HINC 39HINC 38HINC 38HDJNZ 37H,D24C022JMP A2D24C023:SETB P1.7CLR P3.7JB P1.6,$LCALL M001JNB P1.6,$CALL M003JMP A2W24C02: LCALL START1;開始子程序MOV A,39H;寫模式LCALL WRITE;寫數(shù)據(jù)MOV A,40H;存儲位置LCALL WRITEMOV A,41H;存儲數(shù)據(jù)LCALL WRITELCALL STOP1;結(jié)束LCALL M001RETM001: MOV 30H,#1M002: MOV 31H,#248DJNZ 31H,$DJNZ 30H,M002RETM003: MOV 3AH,#4M004: MOV 3BH,#248M005: MOV 3CH,#248DJNZ 3CH,$DJNZ 3BH,M005DJNZ 3AH,M004RETR24C02: LCALL START;開始子程序MOV A,39HLCALL WRITE0MOV A,40H;存儲位置LCALL WRITE0LCALL STARTMOV A,38H;讀模式LCALL WRITE0LCALL READ;讀取數(shù)據(jù)LCALL STOPRETR24C02_1:LCALL START1;開始子程序MOV A,39HLCALL WRITEMOV A,40H;存儲位置LCALL WRITELCALL START1MOV A,38H;讀模式LCALL WRITELCALL READ_1;讀取數(shù)據(jù)LCALL STOP1RETWRITE0: MOV R7,#8WRITE01:RLC AMOV SDA,CSETB SCLNOPNOPNOPNOPCLR SCLNOPDJNZ R7,WRITE01NOPNOPNOPLCALL ACKNOPNOPRET;寫WRITE: MOV R7,#8WRITE1: RLC AMOV SDA1,CSETB SCL1NOPNOPNOPNOPCLR SCL1NOPDJNZ R7,WRITE1NOPNOPNOPLCALL ACK1NOPNOPRET;讀READ: MOV R7,#8READ1: SETB SDASETB SCLMOV C,SDARLC AMOV 32H,ANOPNOPNOPNOPCLR SCLDJNZ R7,READ1LCALL NACKNOPNOPRET;讀READ_1: MOV R7,#8READ01: SETB SDA1SETB SCL1MOV C,SDA1RLC AMOV 32H,ANOPNOPNOPNOPCLR SCL1DJNZ R7,READ01LCALL NACK1NOPNOPRET;應(yīng)答ACK: CLR SDA ;響應(yīng)程序段 應(yīng)答程序NOPSETB SCLNOPNOPNOPNOPCLR SCLNOPNOPRETNACK: SETB SDA ;非應(yīng)答程序段NOPNOPSETB SCLNOPNOPNOPNOPCLR SCLNOPRET;開始START: SETB SCLSETB SDANOPNOPCLR SDANOPNOPNOPNOPCLR SCLRET;結(jié)束STOP: SETB SCLCLR SDANOPNOPNOPNOPSETB SDARET;*********************************************;應(yīng)答ACK1: CLR SDA1 ;響應(yīng)程序段 應(yīng)答程序NOPSETB SCL1NOPNOPNOPNOPCLR SCL1NOPNOPRETNACK1: SETB SDA1 ;非應(yīng)答程序段NOPNOPSETB SCL1NOPNOPNOPNOPCLR SCL1NOPRET;開始START1: SETB SCL1SETB SDA1NOPNOPCLR SDA1NOPNOPNOPNOPCLR SCL1RET;結(jié)束STOP1: SETB SCL1CLR SDA1NOPNOPNOPNOPSETB SDA1RETend
上一頁 1 2 下一頁

關(guān)鍵詞: 2051單片機燒錄24C0

評論


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

關(guān)閉