【正文】
;而 ADD 即為英文單詞,其意為相加。由上可知,要找到實際操作數(shù),有時就要轉(zhuǎn)個彎,甚至轉(zhuǎn)幾個彎,這個過程稱為尋址 4:操作數(shù)放在 RAM某個單元中,該單元的地址又放在寄存器 R0或 R1中。可能有人會問,在指令中直接給出實際操作數(shù),不是簡單明了嗎?為什么還要用其它幾種尋址方式呢 ?這是因為在編制程序時很難一下子就給出操作數(shù)。前面介紹 51 系列單片機(jī)的尋址方式時,常遇到單片機(jī)內(nèi)部的一些寄存器、累加器 A、通用寄存器 R0~ R數(shù)據(jù)指針 DPTR和存貯器等。除 128字節(jié) RAM、 4k字節(jié) ROM和中斷、串行口及定時器模塊外,還有 4 組 I/O 口 P0~ P3,余下的就是 CPU 的全部組成。 AT89C51 是一種帶 4K字節(jié)閃爍可編程可擦除只讀存儲器( FPEROM— Flash :Programmable and Erasable Read Only Memory)的低電壓,高性能 CMOS8位微處理器,俗稱單片機(jī)。 : VCC:供電電壓, GND: 接地, P0 口: P0 口為一個 8位漏級開路雙向 I/O口,每腳可吸收 8TTL門電流。 P1口: P1口是一個內(nèi)部提供上拉電阻的 8位雙向 I/O口, P1口緩沖器能接收輸出 4TTL門電流。并因此作為輸入時, P2 口的管腳被外部拉低,將輸出電流。 P2口在 FLASH編程和校驗時接收高 8位地址信號和控制信號。 P3口也可作為 AT89C51的一些特殊功能口 : RXD(串行輸入口) 、 TXD(串行輸出口) 、 /INT0(外部中斷 0) 、 /INT1(外部中斷 1) 、 T0(記時器 0外部輸入) 、 T1(記時器 1外部輸入 ) 、 /WR(外部數(shù)據(jù)存儲器寫選通) 、 /RXD(外部數(shù)據(jù)存儲器讀選通)。 ALE/PROG:當(dāng)訪問外部存儲器時,地址鎖存允許的輸出電平用于鎖存地址的地位字節(jié)。然而要注意的是:每當(dāng)用作外部數(shù)據(jù)存儲器時, 將跳過一個 ALE脈沖。如果微處理器在外部執(zhí)行狀態(tài) ALE禁止,置位無效。 /EA/VPP:當(dāng) /EA 保持低電平時,則在此期間外部程序存儲器( 0000H~ FFFFH),不管是否有內(nèi)部程序存儲器。 XTAL2:來自反向振蕩器的輸出。如采用外部時鐘源驅(qū)動器件, XTAL2應(yīng)不接。此外, AT89C51設(shè)有穩(wěn)態(tài)邏輯,可以在低到零頻率的條件下靜態(tài)邏輯,支持兩種軟件可選的掉電模式。 About Singlechip Refers to an integrated singlechip at a chip on the integrity of puter systems. Even though most of his features at a small chip on, but it has a plete puter most of the necessary ponents: CPU, memory, internal and external bus system, most will have the Core. At the same time, such as integrated munication interfaces, timers, realtime clock and other peripheral equipment. And now the most powerful singlechip microputer system can even voice, image, work, plex input and output of system integration on a single chip. Also known as singlechip microcontroller, because it is the first to be used in the field of industrial control. Singlechip by chip dedicated processor CPU only evolved. The first design concept through to a large number of peripherals and CPU in a single chip, the puter system so that smaller, more easily integrated into the plex and demanding with regard to the reference control devices. INTEL the Z80 is one of the earliest in accordance with this idea to design the processor, From then on, the MCU and the development of a dedicated processor parted ways. Early singlechip 8bit or all of four. One of the most successful are Intel39。s dedicated processor, while the general model exfactory price dropped to one . dollars, the most highend models, only 10 . dollars. Contemporary singlechip microputer system is no longer only in the baremetal environment development and use of a large number of dedicated embedded operating system is widely used in on a full range of singlechip microputer. In the cell phone as a handheld puter and deal with highend singlechip core can even direct the use of a dedicated Windows and Linux operating systems. Singlechip 8051 CPU by the operator and controller. Calculator to plete the binary arithmetic/logic operations Parts ALU at the core, together with registers on TMP, accumulator ACC, register B, the procedure register PSW status symbol and Boolean processor. Accumulator ACC is an eight registers, which are the most frequent job of CPU registers. In arithmetic, logic operations, the accumulator ACC is often a temporary one at preputing operands (such as being summand), and puting and then save the results (such as algebra and). Register B mainly used for multiplication and division operations. PSW register is also a mark of eight registers, used to store the results of some of the characteristics of puting, if not binary, and so on, and borrow. Its specific meaning of each are shown below. PSW CY AC FO RS1 RS0 OVP to users, the most concerned about are the following four. First of all, the binary symbol CY (PSW7). Whether or not it has express a binary operator (or borrow bits). If the operation results at the highest level there is binary (addition) or borrow (subtraction), the bit is 1, otherwise to 0. Secondly, auxiliary binary symbol AC. Also known as semibinary logo, it reflects both the number eight puting whether there is a half low of four binary, that is, the sum of the four low (or minus) has not binary (or borrow), and if there is AC for one status, otherwise to 0. Third, the overflow flag OV. MCS1 to reflect the number of operator symbols with the results of whether there is any spill, there is spill, this bit is 1, otherwise to 0. Fourth, the parity symbol P. Reflect the content of accumulator ACC parity, if the ACC in an operation that results in evennumbered months have one (such as 11001100B, one of four there is one), then P is 0, otherwise, P = 1. PSW other places, will introduce at a later time. PSW stored procedures because of the status, it is also called the program status character have a calculator in bitwise (bit) to carry out logic operations logic processor (also known as Boolean processor). Its function in the introduction explainbit instruction. About the controller, CPU controller is the nerve center, which includes the timing control logic circuit, an instruction register, decoder, address pointer DPTR and the program counter PC, stack pointer SP and so on. This program counter PC is 16bit register consisting of counters. To singlechip implementation of a program, it is necessary to put the program into memory in advance in order ROM of an area. Single chip action should be taken out of a sequence of mands to be implemented. Therefore, we must have a circuit to find out where the mand module address, the circuit is the program counter PC. When beginning the implementation of singlechip program, to the PC load instructions where the first address, it took out one of each mand (such as for multibyte instructions, each took out a mand byte), PC will automatically add the contents of one to point to the next instruction address, so that instruction can be the order of implementation. Only when the process