V?AB ;(A=03HB=19H)?PUSH?B?MOV?B,#0AH?MUL?AB ;(A=1EB=00H)?POP?B?ADD?A,B ;(A=37HB=19H) MOV?30H,A ;(30H单元的内容=37H)LOOP:?AJMP?LOOPMCS51内部RAM50H~55H单元存放的12个16进制数变为ASCII码,放到2800H单元开始的外部RAM中。MAIN:?MOVR0,#50H?MOVR2,#6MOVDPTR,#2800HHASC:MOVA,@R0ANLA,#0FH ;屏蔽高四位ADDA,#0DHMOVCA,@A+PC?;查表低四位转换为ASCII码MOVX@DPTR,A ;送如外部RAMINCDPTRMOVA,@R0ANLA,#0F0HSWAPAADDA,#6MOVC,@A+PC ;高四位转换为ASCII码MOVX@DPTR,AINCR0INCDPTRDJNZR2,HASCENDASCTAB:DB30H31H32H33H34H35H36H37H38H39H DB41H42H43H44H45H46H编制四个十六进制单字节数相加后求平均的程序。假设4个16进制的单字节分别为a,b,c,d,计算结果方到e中#include<reg51.h>#defineucharunsignedcharvoidmain(void){uchara,b,c,d,e;e=(a+b+c+d)/4;while(1);}用8031的T0定时/计数器,设计程序,实现在P1.0输出50ms的方波,输出100个方波后停止输出。#include<reg51.h>#defineucharunsignedcharuchara;voidmain(void){TMOD=0X01;TL0=0XB0;TH0=0X3C;EA=1;ET0=1;TR0=1;while(1){?if(a==100) { EA=0;