单片机考试题 急啊快考试了
1.如果初始时(A)=3FH,(R0)=4AH执行下面程序段后(A)=?(CY)=?(20H)=?(R0)=?并指出该程序段的功能。(本题5分)CLRCSUBBA,R0M...
1.如果初始时(A)= 3FH,(R0)= 4AH执行下面程序段后(A)=? (CY )=? (20H)=? (R0)=?并指出该程序段的功能。(本题5分)
CLR C
SUBB A,R0
MOV 20H,A
2.如果初始时(20H)=5EH,(21H)=B3H,执行下面程序段后(A)=? (20H)=? (21H)=?并指出该程序段的功能。(本题5分)
MOV A, 20H
CPL A
ADD A, #01H
MOV 20H, A
MOV A, 21H
CPL A
ADDC A, #00H
MOV 21H,A
SJMP $
3.指出下面子程序的功能;设进入下面子程序时(40H)=03H,写出程序运行结果:(A)=?
(40H)=?(DPTR)=?(本题5分)
ORG 1000H
SUB1: MOV A,40H
MOV DPTR, #TAB
MOVC A,@A+DPTR
MOV 40H,A
RET
ORG 2000H
TAB: DB 30H,31H,32H,33H,34H
DB 35H,36H,37H,38H,39H
对好有过程 展开
CLR C
SUBB A,R0
MOV 20H,A
2.如果初始时(20H)=5EH,(21H)=B3H,执行下面程序段后(A)=? (20H)=? (21H)=?并指出该程序段的功能。(本题5分)
MOV A, 20H
CPL A
ADD A, #01H
MOV 20H, A
MOV A, 21H
CPL A
ADDC A, #00H
MOV 21H,A
SJMP $
3.指出下面子程序的功能;设进入下面子程序时(40H)=03H,写出程序运行结果:(A)=?
(40H)=?(DPTR)=?(本题5分)
ORG 1000H
SUB1: MOV A,40H
MOV DPTR, #TAB
MOVC A,@A+DPTR
MOV 40H,A
RET
ORG 2000H
TAB: DB 30H,31H,32H,33H,34H
DB 35H,36H,37H,38H,39H
对好有过程 展开
1个回答
展开全部
1、
CLR C ;(CY)=0
SUBB A,R0 ;(A)=(A0)-(RO)-(CY),则(A)=B5H
MOV 20H,A ;A送给20H单元,则(20H)=B5H
即:(A)=B5H (CY )=0 (20H)=B5H (R0)=4AH
程序功能:实现将A减去R0的差送给20H单元。
2、
MOV A, 20H ;20H单元送给A,则(A)=(20H)=5EH
CPL A ;A(=5EH)取反后送回A,则(A)=A1H
ADD A, #01H ;(A)=(A)+1=A2H
MOV 20H, A ;(20H)=(A)=A2H
MOV A, 21H ;(A)=(21H)=B3H
CPL A ;(A)=4CH
ADDC A, #00H ;(A)=(A)+0+CY=4CH (CY=0)
MOV 21H,A ;(21H)=(A)=4CH
SJMP $ ;原地等待
即:(A)=4CH (20H)=A2H (21H)=4CH
程序功能:将20H单元的数取反后加1(求补),再回送20H单元;将21H单元的数取反后加进位位,再回送21H单元。
3、
ORG 1000H
SUB1: MOV A,40H ;(A)=(40H)=03H
MOV DPTR, #TAB ;TAB表格首地址送DPTR,则(DPTR)=2000H
MOVC A,@A+DPTR ;(A)=(A+DPTR)=(03H+2000H)=(2003H)=33H
MOV 40H,A ;(40H)=(A)=33H
RET ;子程序返回
ORG 2000H
TAB: DB 30H,31H,32H,33H,34H
DB 35H,36H,37H,38H,39H
即::(A)=33H (40H)=33H (DPTR)=2000H
程序功能:查找以A为地址偏移量的数据表格内容。
CLR C ;(CY)=0
SUBB A,R0 ;(A)=(A0)-(RO)-(CY),则(A)=B5H
MOV 20H,A ;A送给20H单元,则(20H)=B5H
即:(A)=B5H (CY )=0 (20H)=B5H (R0)=4AH
程序功能:实现将A减去R0的差送给20H单元。
2、
MOV A, 20H ;20H单元送给A,则(A)=(20H)=5EH
CPL A ;A(=5EH)取反后送回A,则(A)=A1H
ADD A, #01H ;(A)=(A)+1=A2H
MOV 20H, A ;(20H)=(A)=A2H
MOV A, 21H ;(A)=(21H)=B3H
CPL A ;(A)=4CH
ADDC A, #00H ;(A)=(A)+0+CY=4CH (CY=0)
MOV 21H,A ;(21H)=(A)=4CH
SJMP $ ;原地等待
即:(A)=4CH (20H)=A2H (21H)=4CH
程序功能:将20H单元的数取反后加1(求补),再回送20H单元;将21H单元的数取反后加进位位,再回送21H单元。
3、
ORG 1000H
SUB1: MOV A,40H ;(A)=(40H)=03H
MOV DPTR, #TAB ;TAB表格首地址送DPTR,则(DPTR)=2000H
MOVC A,@A+DPTR ;(A)=(A+DPTR)=(03H+2000H)=(2003H)=33H
MOV 40H,A ;(40H)=(A)=33H
RET ;子程序返回
ORG 2000H
TAB: DB 30H,31H,32H,33H,34H
DB 35H,36H,37H,38H,39H
即::(A)=33H (40H)=33H (DPTR)=2000H
程序功能:查找以A为地址偏移量的数据表格内容。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询