精品国产人成在线_亚洲高清无码在线观看_国产在线视频国产永久2021_国产AV综合第一页一个的一区免费影院黑人_最近中文字幕MV高清在线视频

您好,歡迎來電子發(fā)燒友網(wǎng)! ,新用戶?[免費注冊]

您的位置:電子發(fā)燒友網(wǎng)>源碼下載>匯編編程>

各種讀寫演示與漢字顯示程序集合

大小:0.2 MB 人氣: 2017-09-06 需要積分:0

1、93C46讀寫演示程序

???????????????????????????
;*????????????? 93C46讀寫演示程序??????????????????????????????????????????????????????????
;? ???????? S1????? 接??? P3.3??? ;
;???????? S2????? 接??? P3.4??? ;
;???????? S3????? 接??? P3.5??? ;
;???????? S4????? 接??? P3.6??? ;?????????????????????????????????????????????????????????? READ??? EQU??? 0?????? ;93C46讀
??????????????? WRITE?? EQU??? 2?????? ;93C46寫
??????????????? EWEN??? EQU??? 4?????? ;93C46寫使能
??????????????? EWDS??? EQU??? 6?????? ;93C46寫禁止
??????????????? FLG0??? EQU??? 21H.0?? ;標志
??????????????? CS????? BIT??? P2.3??? ;93C46引腳
??????????????? CLK???? BIT??? P2.2??? ;
??????????????? DI????? BIT??? P2.1??? ;
??????????????? DO????? BIT??? P2.0??? ;
??????????????? ADR46?? EQU??? 20H???? ;93c46的地址RAM
;------------------------------------------------------------------
??????????????? DATA1?? EQU??? 30H???? ;
???????? DATA2?? EQU??? 31H???? ;
??????????????? DATA3?? EQU??? 32H???? ;
???????? DATA4?? EQU??? 33H???? ;
? ???????? S1????? BIT??? P3.3??? ;
???????? S2????? BIT??? P3.4??? ;
???????? S3????? BIT??? P3.5??? ;
???????? S4????? BIT??? P3.6??? ;
;*******************************************************************???????????????
??????????????? ORG???? 0000H??????? ;程序執(zhí)行開始地址
??????????????? LJMP??? START??????? ;跳至START
??????????????? ORG???? 0003H??????? ;外中斷0中斷程序入口
??????????????? RETI???????? ;跳至INTEX0中斷服務(wù)程序
??????????????? ORG???? 000BH??????? ;定時器T0中斷程序入口
??????????????? RETI???????? ;中斷返回
??????????????? ORG???? 0013H??????? ;外中斷1中斷入口
??????????????? RETI???????? ;跳至INTEX1中斷服務(wù)程序
??????????????? ORG???? 001BH??????? ;定時器T1中斷程序入口
??????????????? RETI???????? ;跳至INTT1中斷服務(wù)程序
??????????????? ORG???? 0023H??????? ;串口中斷入口地址
??????????????? RETI???????? ;中斷返回
??????????????? ORG???? 002BH??????? ;定時器T2中斷入口地址
??????????????? RETI???????? ;中斷返回
??ORG???? 0030H????????? ;
;********************************************************************????????????
START:????????
?????????????? MOV???? SP,#60H???????? ;
;*******************************************
;*???????????? 讀串行E2PROM???????????????? *
;*******************************************
?????????????? MOV???? R2,#02H???????? ;將93c46 01,02地址的4個數(shù)字存入30H-33H
?????????????? MOV???? R0,#33H???????? ;
?????????????? MOV???? ADR46,#01?????? ;
A1:??????????? MOV???? A,#READ???????? ;93C46讀
?????????????? ACALL?? TO9346????????? ;
?????????????? MOV???? @R0,3CH???????? ;
?????????????? DEC???? R0????????????? ;
?????????????? MOV???? @R0,3DH???????? ;
?????????????? DEC???? R0????????????? ;
?????????????? INC???? ADR46?????????? ;
?????????????? DJNZ??? R2,A1?????????? ;
?????????????? ACALL?? DELAY1MS??????? ;
;*********************************************************************
;*********************************************************************
MAIN:
??????????????? CALL??? DISP?????????? ;調(diào)顯示子程序
???????? CALL??? KEY??????????? ;
???????? AJMP??? MAIN?????????? ;
;**********************************************************************
?
;********************************************************************
KEY:??????????? MOV???? P3,#78H??????? ;
??????????????? MOV???? A, P3????????? ;
??????????????? ANL???? A, #01111000B? ;
??????????????? XRL???? A, #01111000B? ;
??????????????? JZ????? EXIT?????????? ;A=0 跳至 EXIT
??????????????? CALL??? DISP?????????? ;
??????????????? MOV???? P3,#78H??????? ;
??????????????? MOV???? A, P3????????? ;
??????????????? ANL???? A, #01111000B? ;
??????????????? XRL???? A, #01111000B? ;
??????????????? JNZ???? KEY1?????????? ;A不等于0 跳至 KEY1
EXIT:?
??????????????? RET??????????????????? ;??
;------------------------------------------
KEY1:?????????? JNB???? S1,S11???????? ;
??????????????? JNB???? S2,S12???????? ;
???????? JNB???? S3,S13???????? ;
???????? JNB???? S4,S14???????? ;
??????????????? AJMP??? EXIT?????????? ;
;------------------------------------------
S11:
??????????????? INC???? DATA1????????? ;
?? ???????? MOV???? A,DATA1??????? ;
???????? CJNE??? A,#0AH,S1_1??? ;
???????? MOV???? DATA1,#00H???? ;
S1_1:
??????????????? AJMP??? KEY_EXIT?????? ;
;------------------------------------------
S12:
??????????????? INC???? DATA2????????? ;
????????? ?MOV???? A,DATA2??????? ;
????????? CJNE??? A,#0AH,S2_1??? ;
???????? MOV???? DATA2,#00H???? ;
S2_1:
??????????????? AJMP??? KEY_EXIT?????? ;
;------------------------------------------
S13:
??????????????? INC???? DATA3????????? ;
???????? ?MOV???? A,DATA3??????? ;
???????? CJNE??? A,#0AH,S3_1??? ;
???????? MOV???? DATA3,#00H???? ;
S3_1:
??????????????? MOV???? DATA4,DATA3??? ;
??????????????? AJMP??? KEY_EXIT?????? ;
;------------------------------------------
S14:
;*******************************************
;*??????????? 寫串行E2PROM???????????????? *
;*******************************************
E3:???????????? MOV???? R0,#33H??????? ;將30H--35H 密碼值存入93C46 01-03H地址
??????????????? MOV???? ADR46,#01H???? ;
??????????????? MOV???? R2,#02???????? ;
E4:???????????? MOV???? A,#EWEN??????? ;93C46寫使能
??????????????? ACALL?? TO9346
??????????????? MOV???? 3CH,@R0??????? ;密碼存入(3CH)
??????????????? DEC???? R0???????????? ;下一個密碼存入(3DH)
??????????????? MOV???? 3DH,@R0
??????????????? MOV???? A,#WRITE?????? ;93C46寫
??????????????? ACALL?? TO9346???????? ;
??????????????? MOV???? A,#EWDS??????? ;93C46寫禁止
??????????????? ACALL?? TO9346
??????????????? DEC???? R0???????????? ;寫入下一組密碼
??????????????? INC???? ADR46????????? ;
??????????????? DJNZ??? R2,E4????????? ;
S4_1:
??????????????? AJMP??? KEY_EXIT?????? ;
;------------------------------------------
KEY_EXIT:
??????????????? CALL??? DISP?????????? ;
??????????????? MOV???? P3,#78H??????? ;
??????????????? MOV???? A, P3????????? ;
??????????????? ANL???? A, #01111000B? ;
??????????????? XRL???? A, #01111000B? ;
??????????????? JNZ???? KEY_EXIT?????? ;???
??????????????? AJMP??? EXIT?????????? ;
;********************************************************************
DISP:
???????? MOV?A,DATA1??????? ;
??????????????? MOV???? DPTR,#TABLE??? ;??
??????? ?MOVC?A,@A+DPTR????? ;取數(shù)據(jù)表數(shù)據(jù)
???????? MOV?P0,A?????????? ;DATA1 顯示代碼傳送到P0口
???????? CLR?P1.0?????????? ;
??????? ?LCALL?DELAY1MS?????? ;
???????? SETB?P1.0?????????? ;
???????? MOV?A,DATA2??????? ;
?????????? ?MOVC?A,@A+DPTR????? ;取數(shù)據(jù)表數(shù)據(jù)
???????? MOV?P0,A?????????? ;DATA2 顯示代碼傳送到P0口
???????? CLR?P1.1?????????? ;
???????? LCALL?DELAY1MS?????? ;
???????? SETB?P1.1?????????? ;
???????? MOV?A,DATA3??????? ;
???????? ?MOVC?A,@A+DPTR????? ;取數(shù)據(jù)表數(shù)據(jù)
???????? MOV?P0,A?????????? ;DATA3 顯示代碼傳送到P0口
???????? CLR?P1.2?????????? ;
???????? LCALL?DELAY1MS?????? ;
???????? SETB?P1.2?????????? ;
???????? MOV?A,DATA4??????? ;
????????? MOVC?A,@A+DPTR????? ;取數(shù)據(jù)表數(shù)據(jù)
???????? MOV?P0,A?????????? ;DATA4 顯示代碼傳送到P0口
???????? CLR?P1.3?????????? ;
???????? LCALL?DELAY1MS?????? ;
???????? SETB?P1.3?????????? ;
???????? RET??????????????????? ;
;*******************************************
DELAY1MS:?
???????? MOV?R4,#2????????? ;延時子程序
DEL1:
???????? MOV?R5,#250??????? ;
???????? DJNZ?R5,$?????????? ;
???????? DJNZ?R4,DEL1??????? ;
??????????????? RET??????????????????? ;
;*********************************************
;延時10MS子程序,用於消除按鍵抖動而產(chǎn)生誤動作????????????
;*********************************************
DELAY10MS:
????????? MOV???? R4,#20???????? ;
DEL2:
???????? MOV???? R5,#250??????? ;
???????? DJNZ??? R5,$?????????? ;
???????? DJNZ??? R4,DEL2??????? ;
??????????????? RET??????????????????? ;
;******************************************************************

;******************************************************************
TO9346:
?????????????? CLR????? CLK??????????? ;CLK=0
?????????????? SETB???? CS???????????? ;93C46 CS=1
?????????????? SETB???? DI???????????? ;DI=1
?????????????? SETB???? CLK??????????? ;CLK=1
?????????????? ACALL??? DELAY1???????? ;啟動位
?????????????? CLR????? CLK??????????? ;CLK=0
?????????????? ACALL??? DELAY2
?????????????? MOV????? DPTR,#JPTBL46
?????????????? JMP????? @A+DPTR??????? ;依ACC值跳至相關(guān)地址
JPTBL46:?????? AJMP???? SREAD????????? ;讀
?????????????? AJMP???? SWRITE???????? ;寫
?????????????? AJMP???? SEWEN????????? ;寫使能
?????????????? AJMP???? SEWDS????????? ;寫禁止
SREAD:???????? MOV????? A,ADR46??????? ;載入93C46地址
?????????????? ADD????? A,#80H???????? ;10******操作碼
?????????????? ACALL??? SDT46????????? ;讀入地址(DI)
?????????????? ACALL??? RDT46????????? ;讀出數(shù)據(jù)(DO),存入3CH
?????????????? MOV????? 3CH,A
?????????????? ACALL??? RDT46????????? ;讀出數(shù)據(jù)(DO),存入3CH
?????????????? MOV????? 3DH,A
?????????????? JMP????? EX9346
;**************************************************************
SWRITE:??????? MOV????? A,ADR46??????? ;載入93C46地址
?????????????? ADD????? A,#40H???????? ;01******操作碼
?????????????? ACALL??? SDT46????????? ;讀入地址
?????????????? MOV????? A,3CH????????? ;寫入(3CH)的數(shù)據(jù)
?????????????? ACALL??? SDT46
?????????????? MOV????? A,3DH????????? ;寫入(3DH)的數(shù)據(jù)
?????????????? ACALL??? SDT46
?????????????? JMP????? EX9346???????? ;
SEWEN:???????? MOV????? A,#30H???????? ;寫使能操作碼
?????????????? ACALL??? SDT46
?????????????? JMP????? EX9346
;**************************************************************
SEWDS:???????? CLR????? A????????????? ;寫禁止操作碼
?????????????? ACALL??? SDT46
EX9346:??????? CLR????? CS???????????? ;CS=0
?????????????? RET
;**************************************************************
SDT46:???????? MOV????? 22H,#8???????? ;左移8次
SD1:?????????? RLC????? A
?????????????? MOV????? DI,C?????????? ;從DI讀入
?????????????? SETB???? CLK
?????????????? ACALL??? DELAY1
?????????????? CLR????? CLK
?????????????? ACALL??? DELAY2
?????????????? DJNZ???? 22H,SD1
?????????????? RET
;**************************************************************
RDT46:???????? MOV????? 22H,#8???????? ;左移8次
RD1:?????????? SETB???? CLK
?????????????? ACALL??? DELAY1
?????????????? CLR????? CLK
?????????????? ACALL??? DELAY2
?????????????? MOV????? C,DO?????????? ;從DO讀出
?????????????? RLC????? A
?????????????? DJNZ???? 22H,RD1
?????????????? RET
;**************************************************************
DELAY1:??????? MOV????? R7,#08H
?????????????? DJNZ???? R7,$
?????????????? RET
;**************************************************************
DELAY2:??????? MOV????? R7,#1FH
?????????????? DJNZ???? R7,$
?????????????? RET
;**************************************************************

;**************************************************************
TABLE:
???????? DB?11000000B????? ;0
???????? DB?11111001B????? ;1
???????? DB?10100100B????? ;2
???????? DB?10110000B????? ;3
???????? DB?10011001B????? ;4
??????? ?DB?10010010B????? ;5
???????? ?DB?10000010B????? ;6
????? ???????? DB?11111000B????? ;7
???????? DB?10000000B????? ;8
??????? ?DB?10010000B????? ;9
??????????????? END??????????????????? ;程序結(jié)束
;**************************************************************

非常好我支持^.^

(0) 0%

不好我反對

(0) 0%

      發(fā)表評論

      用戶評論
      評價:好評中評差評

      發(fā)表評論,獲取積分! 請遵守相關(guān)規(guī)定!

      ?