《单片机原理及应用》复习题及相关答案.doc 下载本文

MOV A, 31H ; A = 23H ORL A, #0F0H ;A= F3H

SWAP A ; A=3FH MOV 42H, A ;(42H) = 3FH 则(41H)= 03H ,(42H)= 3FH 。

3.已知(R0)=20H, (20H ) =10H, (P0) =30H, (R2) =20H, 执行如下程序段后

MOV @R0 , #11H ; (20H) = 11H MOV A , R2 ;A = 20H ADD A , 20H ;A = 31H MOV PSW , #80H ;CY = 1

SUBB A , P0 ; 31H-1-30H = 00H ,CY =0 MOV 40H , A ;(40H) = A = 00H 结果是:( 40H ) = 00H ,CY= 0 。

4. 设在MCS-51单片机片内RAM中,(20H)=40H,(40H)=22H,(22H)=10H,P1=0CFH,当下列程序执行完毕后,各单元的内容分别为多少?请填入给定的各个寄存器及片内单元中。

MOV R0,#20H ; R0 = 20H MOV A,@R0 ;A=40H MOV R1,A ;R1 = 40H MOV B,@R1 ;B = 22H MOV @R1,R1 ;(40H) =40H MOV P3,P1 ;P3 = 0CFH

(A)=40H (B)= 22H (R0)= 20H (R1)= 40H (P1)= 0CFH (P3)= 0CFH (20H)= 40H (22H)=10H 五、程序设计题

1、使用定时器中断方式编程实现从P1.0引脚上输出一个周期为1s的方波。(系统时钟为6MHz)。

2、编程将片内RAM 40H 单元开始的16个数传送到片外RAM 2000H 开始的单元中。

3、根据硬件图计算ADC0809的8个模拟量输入通道的地址,并编写程序实现8 个通道的模拟量循环采集,采集结构存放至片内RAM 40H~47H中。

U?1234567813INT01215143119189RDWR1716P10P11P12P13P14P15P16P17INT1INT0T1T0EA/VPX1X2RESETRDWR8051RD2RXDTXDALE/PPSEN10113029WR121U?A3U?A3P00P01P02P03P04P05P06P07P20P21P22P23P24P25P26P2739383736353433322122232425262728D0D1D2D3D4D5D6D7INT0A0A1A2D7D6D5D4D3D2D1D02120191881514177252423229610U?msb2-12-22-32-42-52-62-7lsb2-8EOCIN-5ADD-AADD-BADD-CALEENABLESTARTCLOCKADC0809500KHZref(-)ref(+)1612VCCIN-6IN-7IN-0IN-1IN-2IN-3IN-426272812345