Re: [課業] 幫解釋一下題目@@~

看板FCU_EE97A作者 (忘了回憶忘了忘記)時間16年前 (2009/03/25 13:02), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《FBLZA (我還是很喜歡妳)》之銘言: : PAGE.1 : 1. Draw the block diagram of 8051 and list all register in each function : unit which are used by programmer. : 2. Explain the operation of stack in 8051. : 3. What is the PSW in 8051. : 4. Execute the following instructions. Please note each instruction is not : independent. : PAGE.2 ---------------------------------------------------------------------------- ORG 0000H ; MOV R0, #00H ; R0=0, point to memory 0 MOV R1, R0 ; R1=R0, R1 record the occurence of 1 in binary representation (R1記錄二進位的0發生次數) MOV R2, #08H ; R2=8, R2 is loop counter, MOV A, @R0 ; A = mem(0) CLR C ; 清除carry flag AGAIN RRC A ; RRC A是把A的數字往右shift,shfit掉的bit放進carry flag, 原本的carry flag放進A的最左邊 EX:C A 1 00011100 0 10001110 JNC NEXT ; 如果有進位就跳到NEXT(A的最右邊bit如果是1, shift到C就是指進位) INC R1 ; 紀錄R1發生幾次0 (就是 R1 = R1+1) NEXT DJNZ R2 AGAIN ; R2 = R2-1 , 如果R2 ≠ 0則跳到AGAIN END ; ------------------------------------------------------------------------------ "好像"是在算二進位有幾個0 (ex:1110 0101 有3個0) 我不確定....8051不熟XD 第一題問別人吧 我下午還要報告T^T -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.124.72.17
文章代碼(AID): #19oRhagr (FCU_EE97A)
文章代碼(AID): #19oRhagr (FCU_EE97A)