試編寫MCS-51單片機程序,計算∑i,I=1~100。
參考單片機匯編語言程序:
org000h
ljmpmain
org030h
main:mov 45h,#011h
mov 46h,#022h
mov 47h,#033h
mov 48h,#044h
mov 49h,#00h
mov r0,#45h
mov r7,#5
mov r6,#4
acallyiwei
sjmp $
yiwei:clr c
loop2:mov a,@r0
rrc a
mov @r0,a
inc r0
djnzr7,loop2
movr0,#45h
movr7,#5
djnzr6,yiwei
ret