外文資料翻譯 --AT89S52單片機(jī)簡(jiǎn)介_第1頁
外文資料翻譯 --AT89S52單片機(jī)簡(jiǎn)介_第2頁
外文資料翻譯 --AT89S52單片機(jī)簡(jiǎn)介_第3頁
外文資料翻譯 --AT89S52單片機(jī)簡(jiǎn)介_第4頁
外文資料翻譯 --AT89S52單片機(jī)簡(jiǎn)介_第5頁
已閱讀5頁,還剩6頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、外文文獻(xiàn)及翻譯a brief introduction of at89s522.pin description2.1 vcc: supply voltage.2.2 gnd: ground.2.3 port 0: port 0 is an 8-bit open drain bidirectional i/o port. as an output port, each pin can sink eight ttl inputs. when 1s are written to port 0 pins, the pins can be used as high-impedance inputs. p

2、ort 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. in this mode, p0 has internal pull-ups. port 0 also receives the code bytes during flash programming and outputs the code bytes during program verification. external pul

3、l-ups are required during program verification.2.4 port 1: port 1 is an 8-bit bidirectional i/o port with internal pull-ups. the port 1 output buffers can sink/source four ttl inputs. when 1s are written to port 1 pins, they are pulled high by the internal pulled-ups and can be used as inputs. as in

4、puts, port 1 pins that are externally being pulled low will source current (iil) because of the internal pull-ups. in addition, p1.0 and p1.1 can be configured to be the timer/counter 2 external count input (p1.0/t2) and the timer/counter 2 trigger input (p1.1/t2ex), respectively, as shown in the fo

5、llowing table.port 1 also receives the low-order address bytes during flash programming and verification.port pinalternate functionsp1.0t2 (external count input to timer/counter 2), clock-outp1.1t2ex (timer/counter 2 capture/reload trigger and direction control)p1.5mosi (used for in-system programmi

6、ng)p1.6miso (used for in-system programming)p1.7sck (used for in-system programming)2.5 port 2: port 2 is an 8-bit bidirectional i/o port with internal pull-ups. the port 2 output buffers can sink/source four ttl inputs. when 1s are written to port 2 pins, they are pulled high by the internal pull-u

7、ps and can be used as inputs. as inputs, port 2 pins that are externally being pulled low will source current (iil) because of the internal pull-ups. port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addre

8、sses (mobxdptr). in this application, port 2 uses strong internal pull-ups when emitting 1s. during accesses to external data memory that use 8-bit addresses (movxri),port 2 emits the contents of the p2 special function register. port 2 also receives the high-order address bits and some control sign

9、als during flash programming and verification.2.6 port 3: port 3 is an 8-bit bidirectional i/o port with internal pull-ups. the port 3 output buffers can sink/source four ttl inputs. when 1s are written to port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. as input

10、s, port 3 pins that are externally being pulled low will source current (iil) because of the pull-ups. port 3 receives some control signals for flash programming and verification. port 3 also serves the functions of various special features of the at89s52, as shown in the following table.port pinalt

11、ernate functionsp3.0rxd (serial input port)p3.1txd (serial output port)p3.2(external interrupt 0)p3.3(external interrupt 1)p3.4t0 (timer 0 external input)p3.5t1 (timer 1 external input)p3.6(external data memory write strobe)p3.7(external data memory read strobe)2.7 rst: reset input. a high on this p

12、in for two machine cycles while the oscillator is running resets the device. this pin drives high for 98 oscillator periods after the watchdog times out. the disrto bit in sfr auxr (address 8eh) can be used to disable this feature. in the default state of bit disrto, the reset high out feature is en

13、abled.2.8 ale/: address latch enable (ale) is an output pulse for latching the low byte of the address during accesses to external memory. this pin is also the program pulse input () during flash programming. in normal operation, ale is emitted at a constant rate of 1/6 the oscillator frequency and

14、may be used for external timing or clocking purposes. note, however, that one ale pulse is skipped during each access to external data memory. if desired, ale operation can be disabled by setting bit 0 or sfr location 8eh. with the bit set, ale is active only during a movx or movc instruction. other

15、wise, the pin is weakly pulled high. setting the ale-disable bit has no effect if the microcontroller is in external execution mode.2.9 : program store enable () is the read strobe to external program memory. when the at89s52 is executing code from external program memory, is activated twice each ma

16、chine cycle, except that two activations are skipped during each access to external data memory.2.10 /vpp: external access enable. must be strapped to gnd in order to enable the device to fetch code from external program memory locations starting at 0000h up to ffffh. note, however, that if lock bit

17、 1 is programmed, will be internally latched on reset. should be strapped to vcc for internal program executions. this pin also receives the 12-volt programming enable voltage (vpp) during flash programming.2.11 xtal1: input to the inverting oscillator amplifier and input to the internal clock opera

18、ting circuit.2.12 xtal2: output from the inverting oscillator amplifier.3.memory organizationmcs-51 devices have a separate address space for program and data memory. up to 64k bytes each of external program and data memory can be addressed.3.1 program memoryif the ea pin is connected to gnd, all pr

19、ogram fetches are directed to external memory. on the at89s52, if is connected to vcc, program fetches to addresses 0000h through 1fffh are directed to internal memory and fetches to addresses 2000h through ffffh are to external memory.3.2 data memorythe at89s52 implements 256 bytes of on-chip ram.

20、the upper 128 bytes occupy a parallel address space to the special function registers. this means that the upper 128 bytes have the same addresses as the sfr space but are physically separate from sfr space. when an instruction accesses an internal location above address 7fh, the address mode used i

21、n the instruction specifies whether the cpu accesses the upper 128 bytes of ram or the sfr space. instructions which use direct addressing access the sfr space. for example, the following direct addressing instruction accesses the sfr at location 0a0h (which is p2).mov 0a0h, #datainstructions that u

22、se indirect addressing access the upper 128 bytes of ram. for example, the following indirect addressing instruction, where r0 contains 0a0h, accesses the data byte at address 0a0h, rather than p2 (whose address is 0a0h).mov r0, #datanote that stack operations are examples of indirect addressing, so

23、 the upper 128 bytes of data ram are available as stack space.4.watchdog timer (one-time enabled with reset-out)the wdt is intended as a recovery method in situations where the cpu may be subjected to software upsets. the wdt consists of a 14-bit counter and the watchdog timer reset (wdtrst) sfr. th

24、e wdt is defaulted to disable from exiting reset. to enable the wdt, a user must write 01eh and 0e1h in sequence to the wdtrst register (sfr location 0a6h). when the wdt is enabled, it will increment every machine cycle while the oscillator is running. the wdt timeout period is dependent on the exte

25、rnal clock frequency. there is no way to disable the wdt except though reset (either hardware reset or wdt overflow reset). when wdt overflows, it will drive an output reset high pulse at the rst pin.5.uartthe uart in the at89s52 operates the same way as the uart in the at89c51 and at89c52. for furt

26、her information on the uart operation, please click on the document link below:6.timer 0 and 1timer 0 and timer 1 in the at89s52 operate the same way as timer 0 and timer 1 in the at89c51 and at89c52. for further information on the timers operation, please click on the document link below:7.timer 2t

27、imer 2 is a 16-bit timer/counter that can operate as either a timer or an event counter. the type of operation is selected by bit c/ in the sfr t2con. timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. the modes are selected by bits in t2con, as s

28、hown in table 6-1. timer 2 consists of two 8-bit registers, th2 and tl2. in the timer function, the tl2 register is incremented every machine cycle. since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency.table 6-1 timer 2 operating modesrclk+tclkc

29、p/tr2mode00116-bit auto-reload01116-bit capture1x1baud rate generatorxx0(off)in the counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, t2. in this function, the external input is sampled during s5p2 of every machine cycle. when t

30、he samples show a high in one cycle and a low in the next cycle, the count is incremented. the new count value appears in the register during s3p1 of the cycle following the one in which the transition was detected. since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0

31、transition, the maximum count rate is 1/24 of the oscillator frequency. to ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle.7.1 capture mode in the capture mode, two options are selected by bit exen2 in t2con. if exen2

32、=0, timer 2 is a 16-bit timer or counter which upon overflow sets bit tf2 in t2con. this bit can then be used to generate an interrupt. if exen2=1, timer 2 performs the same operation, but a 1-to-0 transition at external input t2ex also causes the current value in th2 and tl2 to be captured into rca

33、p2h and rcap2l, respectively. in addition, the transition at t2ex causes bit exf2 in t2con to be set. the exf2 bit, like tf2, can generate an interrupt.7.2 auto-reload (up or down counter) timer 2 can be programmed to count up or down when configured in its 16-bit auto-reload mode. this feature is i

34、nvoked by the dcen (down counter enable) bit located in the sfr t2mod. upon reset, the dcen bit is set to 0 so that timer 2 will default to count up. when dcen is set, timer 2 can count up or down, depending on the value of the t2ex pin. timer 2 automatically counting up when dcen=0. in this mode, t

35、wo options are selected by bit exen2 in t2con. if exen2=0, timer 2 counts up to 0ffffh and then sets the tf2 bit upon overflow. the overflow also causes the timer registers to be reloaded with the 16-bit value in rcap2h and rcap2l. the values in timer in capture mode rcap2h and rcap2l are preset by

36、software. if exen2=1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input t2ex. this transition also sets the exf2 bit. both the tf2 and exf2 bits can generate an interrupt if enabled. setting the dcen bit enables timer 2 to count up or down, as shown i

37、n figure 10-2. in this mode, the t2ex pin controls the direction of the count. a logic 1 at t2ex makes timer 2 count up. the timer will overflow at 0ffffh and set the tf2 bit. this overflow also causes the 16-bit value in rcap2h and rcap2l to be reloaded into the timer registers, th2 and tl2, respec

38、tively. a logic 0 at t2ex makes timer 2 count down. the timer underflows when th2 and tl2 equal the values stored in rcap2h and rcap2l. the underflow sets the tf2 bit and causes 0ffffh to be reloaded into the timer registers. the exf2 bit toggles whenever timer 2 overflows or underflows and can be u

39、sed as a 17th bit of resolution. in the operating mode, exf2 does not flag an interrupt.8.baud rate generatortimer 2 is selected as the baud rate generator by setting tclk and/or rclk in t2con. note that the baud rates for transmit and receive can be different if timer 2 is used for the receiver or

40、transmitter and timer 1 is used for the other function. setting rclk and/or tclk puts timer 2 into its baud rate generator mode. the baud rate generator mode is similar to the auto-reload mode, in that a rollover in th2 causes the timer 2 registers to be reloaded with the 16-bit value in registers r

41、cap2h and rcap2l, which are preset by software. the baud rates in modes 1 and 3 are determined by timer 2s overflow rate according to the following equation.modes 1 and 3 baud rates=the timer can be configured for either timer or counter operation. in most applications, it is configured for timer op

42、eration (cp/=0). the timer operation is different for timer 2 when it is used as a baud rate generator. normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency). as a baud rate generator, however, it increments every state time (at 1/2 the oscillator frequency). the

43、 baud rate formula is given below.where (rcap2h, rcap2l) is the content of rcap2h and rcap2l taken as a 16-bit unsigned integer.this figure is valid only if rclk or tclk=1 in t2con. note that a rollover in th2 does not set tf2 and will not generate an interrupt. note too, that if exen2 is set, a 1-t

44、o-0 transition in t2ex will set exf2 but will not cause a reload from (rcap2h, rcap2l) to (th2, tl2). thus, when timer 2 is in use as a baud rate generator, t2ex can be used as an extra external interrupt. note that when timer 2 is running (tr2=1) as a timer in the baud rate generator mode, th2 and

45、tl2 should not be read from or written to. under these conditions, the timer is incremented every state time, and the results of a read or write may not be accurate. the rcap2 registers may be read but should not be written to, because a write might overlap a reload and cause write and/or reload err

46、ors. the timer should be turned off (clear tr2) before accessing the timer 2 or rcap2 registers.9.interruptsthe at89s52 has a total of six interrupt vectors: two external interrupts ( and ), three timer interrupts (timers 0,1 and 2), and the serial port interrupt. each of these interrupt sources can

47、 be individually enabled or disabled by setting or clearing a bit in special function register ie. ie also contains a global disable bit, ea, which disables all interrupts at once. note that bit position ie.6 is unimplemented. user software should not write a 1 to this bit position, since it may be

48、used in future at89 products. timer 2 interrupt is generated by the logical or of bits tf2 and exf2 in register t2con. neither of these flags is cleared by hardware when the service routine is vectored to. in fact, the service routine may have to determine whether it was tf2 or exf2 that generated t

49、he interrupt, and that bit will have to be cleared in software. the timer 0 and timer 1 flags, tf0 and tf1, are set at s5p2 of the cycle in which the timers overflow. the values are then polled by the circuitry in the next cycle. however, the timer 2 flag, tf2, is set at s2p2 and is polled in the sa

50、me cycle in which the timer overflows.10.oscillator characteristicsxtal1 and xtal2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator. either a quartz crystal or ceramic resonator may be used. to drive the device from an external

51、 clock source, xtal2 should be left unconnected while xtal1 is driven. there are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications m

52、ust be observed.at89s52單片機(jī)簡(jiǎn)介2.引腳功能2.1 vcc:電源2.2 gnd:接地2.3 p0:p0口是一個(gè)8位開路漏極雙向i/o口。作為一個(gè)輸出端口,每個(gè)引腳能驅(qū)動(dòng)8個(gè)ttl輸入。當(dāng)對(duì)p0端口寫“1”時(shí),引腳可被用于高阻抗輸入。當(dāng)訪問外部程序和數(shù)據(jù)存儲(chǔ)器時(shí),p0口也可被設(shè)定低位地址/數(shù)據(jù)總線多路復(fù)用。在這種模式下,p0具有內(nèi)部上拉電阻。在flash編程時(shí),p0口也接收編碼字節(jié);在程序校驗(yàn)時(shí),輸出編碼字節(jié)。程序校驗(yàn)時(shí),外部上拉電阻是必備的。2.4 p1口:p1口是一個(gè)具有內(nèi)部上拉電阻的8位雙向i/o口。p1輸出緩沖器能驅(qū)動(dòng)4個(gè)ttl輸入。對(duì)p1引腳寫“1”時(shí),它們被內(nèi)

53、部上拉電阻拉高,并且可用作輸入。用作輸入時(shí),被外部拉低的p1引腳由于內(nèi)部上拉電阻的原因,將輸出電流(iil)。另外,p1.0和p1.1可被分別設(shè)定為定時(shí)器/計(jì)數(shù)器2的外部計(jì)數(shù)輸入(p1.0/t2)和定時(shí)器/計(jì)數(shù)器2的觸發(fā)脈沖輸入(p1.1/t2ex),如下表所示。在flash編程和校驗(yàn)時(shí),p1口也接收低位地址字節(jié)。引腳號(hào)第二功能p1.0t2(定時(shí)器/計(jì)數(shù)器t2的外部計(jì)數(shù)輸入),時(shí)鐘輸出p1.1t2ex(定時(shí)器/計(jì)數(shù)器t2的捕捉/重載觸發(fā)信號(hào)和方向控制)p1.5mosi(用于系統(tǒng)編程)p1.6miso(用于系統(tǒng)編程)p1.7sck(用于系統(tǒng)編程)2.5 p2口:p2口是一個(gè)具有內(nèi)部上拉電阻的8位

54、雙向i/o口。p2輸出緩沖器能驅(qū)動(dòng)4個(gè)ttl輸入。對(duì)p2引腳寫“1”時(shí),它們被內(nèi)部上拉電阻拉高,并且可用作輸入。用作輸入時(shí),被外部拉低的p2引腳由于內(nèi)部上拉電阻的原因,將輸出電流(iil)。在訪問外部程序存儲(chǔ)器,以及用16位地址讀取外部數(shù)據(jù)存儲(chǔ)器(movxdptr)時(shí),p2口發(fā)出高位字節(jié)。在這種應(yīng)用中,發(fā)送1時(shí)p2口使用很強(qiáng)的內(nèi)部上拉電阻。在使用8位地址(movxri)訪問外部數(shù)據(jù)存儲(chǔ)器時(shí),p2口輸出p2特殊函數(shù)寄存器的內(nèi)容。在flash編程和校驗(yàn)時(shí),p2口也接收高位地址字節(jié)和一些控制信號(hào)。2.6 p3口:p3口是一個(gè)具有內(nèi)部上拉電阻的8位雙向i/o口。p3輸出緩沖器能驅(qū)動(dòng)4個(gè)ttl輸入。對(duì)p

55、3引腳寫“1”時(shí),它們被內(nèi)部上拉電阻拉高,并且可用作輸入。用作輸入時(shí),被外部拉低的p3引腳由于內(nèi)部上拉電阻的原因,將輸出電流(iil)。p3口為flash編程和校驗(yàn)接收一些控制信號(hào)。p3口也提供一些at89s52 的特別功能,如下表所示。引腳號(hào)第二功能p3.0rxd(串行輸入口)p3.1txd(串行輸出口)p3.2(外部中斷0)p3.3(外部中斷1)p3.4t0(定時(shí)器0外部輸入)p3.5t1(定時(shí)器1外部輸入)p3.6(外部數(shù)據(jù)存儲(chǔ)器寫選通)p3.7(外部數(shù)據(jù)存儲(chǔ)器讀c選通)2.7 rst:復(fù)位輸入。當(dāng)振蕩器重置設(shè)備時(shí),引腳上的高電平作用2個(gè)機(jī)器工作周期??撮T狗終止后,引腳輸出98個(gè)振蕩周期

56、的高電平。特殊函數(shù)寄存器auxr(地址8eh)上的disrto位可以使此功能無效。disrto默認(rèn)狀態(tài)下,復(fù)位高電平功能被激活。2.8 ale/:地址鎖存器選通(ale)是訪問外部存儲(chǔ)器時(shí),鎖存低位地址的輸出脈沖。在flash編程時(shí),此引腳()也用作編程脈沖輸入。在一般情況下,ale以六分之一的固定振蕩器頻率輸出,且可用來作為外部定時(shí)器或時(shí)鐘作用。然而,特別強(qiáng)調(diào),在每次訪問外部數(shù)據(jù)存儲(chǔ)器時(shí),ale脈沖是跳躍的。如果需要,通過設(shè)置0位或sfr定位8eh,ale操作將無效。經(jīng)過該位設(shè)置,ale僅在movx或movc指令時(shí)起作用。否則,ale將被微弱拉高。如果微控制器在外部執(zhí)行模式下,設(shè)置ale無效

57、位不生效。2.9 :允許程序存儲(chǔ)器()是外部程序存儲(chǔ)器的讀選通。當(dāng)at89s52從外部程序存儲(chǔ)器執(zhí)行代碼時(shí),除了當(dāng)每次訪問外部數(shù)據(jù)存儲(chǔ)器時(shí)兩個(gè)激活是跳躍的之外,在每個(gè)機(jī)器周期被激活兩次。2.10 /vpp:可供外部檢查。為了使設(shè)備接收外部程序存儲(chǔ)器0000h至ffffh的編碼,必須接gnd。為了執(zhí)行內(nèi)部程序,應(yīng)該接vcc。在flash編程期間,引腳也接收12伏可供編程電壓。2.11 xtal1:振蕩器反相放大器和內(nèi)部時(shí)鐘發(fā)生電路的輸入端。2.12 xtal2:振蕩器反相放大器的輸出端。3.存儲(chǔ)器結(jié)構(gòu)mcs-51設(shè)備有單獨(dú)的程序和數(shù)據(jù)存儲(chǔ)器地址空間。每個(gè)外部程序和數(shù)據(jù)存儲(chǔ)器可被尋址直到64k字節(jié)。3.1 程序存儲(chǔ)器如果引腳接地,所有程序都從外部存儲(chǔ)器取出。對(duì)于89s52,如果接vcc,地址為0000h1fffh的程序從內(nèi)部存儲(chǔ)器取出,地址為2000hffffh的程序從外部存儲(chǔ)器取出。3.2 數(shù)據(jù)存儲(chǔ)器at89s52有256字節(jié)片內(nèi)數(shù)據(jù)存儲(chǔ)器。高128字節(jié)占用與特殊功能寄存器相似的地址空間。意思是高128字節(jié)與sfr有相同的地址,而物理上不同于sfr。當(dāng)一條指令訪問一個(gè)高于7fh的內(nèi)部地址時(shí),尋址方式指定cpu訪問高128字節(jié)ram還是sfr空間。直接尋址方式訪問特殊功能寄存器空間的說明。例如,下面的直接尋址指令訪問0a0h(p2口)的特殊功能寄存器。mov 0

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論