版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、<p><b> 附錄3:外文翻譯</b></p><p> AT89C52 monolithic integrated circuit introduction</p><p> AT89C52 is the low voltage which American ATMEL Corporation produces, the high perform
2、ance CMOS 8 monolithic integrated circuits, internal may repeatedly scratch read-only program memory (PEROM) and 256bytes random access data-carrier storage (RAM) including 8k bytes which writes, the component uses ATMEL
3、 Corporation the high density, the non-volatility memory technology production, is compatible with the standard MCS-51 command system and 8052 product pins, internal sets at general 8 central pr</p><p> Fun
4、ction characteristic outline: </p><p> Below AT89C52 provides the standard function: 8k byte Flash dodges the fast memory, 256 byte internal RAM,32 I/O mouth line, 3 16 fixed time/counters, 6 vector two lev
5、el of interrupt structures, A full-duplex serial passes unguardedly, internal oscillator and clock electric circuit.At the same time, AT89C52 may fall to the 0HZ static state logical operation, and supports the electrici
6、ty saving working pattern which two kind of softwares may elect.The idle way stops CPU the work, but permits RAM,</p><p> The pin function shows </p><p> Vcc: Supply voltage </p><p&
7、gt; GND: Grounding</p><p> P0 mouth: The P0 mouth is one group of 8 leaks leads the way extremely the bidirectional I/O mouth, also is the address/data bus multiplying mouth.As outlet with when, each pote
8、ntial energy absorption current way actuates 8 TTL logic gate, when writes “1” to port P0, may take the high impedance input end uses.</p><p> When visits exterior data-carrier storage or the program memory
9、, when this group of mouth line segment transforms the address (low 8) and the data bus multiplying, pulls the resistance in the visit activation interior. </p><p> When Flash programming, P0 mouth receive
10、instruction byte, but when program check, when output order byte, verification, outside the request joins pulls the resistance</p><p> P1 mouth: P1 is in a belt interior pulls the resistance 8 bidirectional
11、 I/O mouth, the P1 output buffer may actuate (absorption or output current) 4 TTL logic gate.Writes “1” to the port, pulls the resistance through internal on to pull the port to the high level, this time may make the inp
12、ut port.When makes the input port use, because in internal existence pulls the resistance, some pin is pulled lowly by exterior signal when can output electric current (IIL).</p><p> With at89C51 similarity
13、 is, P1.0 and P1.1 also may take separately fixed time/the counter 2 exterior countings inputs (P1.0/T2) and inputs (P1.1/T2EX), see also table 1. </p><p> Flash programming and program check period, P1 rec
14、eives the low 8 bit address.</p><p> Table 1 P1.0 and P1.1 second function</p><p> P2 mouth: P2 is one has in the interior to pull the resistance 8 bidirectional I/O mouth, the P2 output buffe
15、r may actuate (absorption or output current) 4 TTL logic gate.Writes “1” to port P2, pulls the resistance through internal on to pull the port to the high level, this time may make the input port, when makes the input po
16、rt use, because in internal existence pulls the resistance, some pin is pulled lowly by exterior signal when can output electric current (IIL).</p><p> When visits exterior program memory or 16 bit address
17、exterior data-carrier storage (e.g. carries out the MOVX@DPTR instruction), the P2 mouth sends out the high 8 bit address data.When visits 8 bit addresses exterior data-carrier storage (for example carries out the MOVX@R
18、I instruction), the P2 mouth outputs the P2 latch the content</p><p> When Flash programming or verification, P2 also receives the top digit address and some control signal.</p><p> P3 mouth:
19、The P3 mouth is a group has in the interior to pull the resistance 8 bidirectional I/O mouth.The P3 mouth output buffer may actuate (absorption or output current) 4 TTL logic gate.Reads in “1” when to the P3 mouth, they
20、the position resistance are pulled by the interior in Gao Bingke the achievement to input the port.This time, will be pulled by the outside the low P3 mouth to use to pull resistance output current (IIL). </p><
21、;p> The P3 mouth besides took the general I/O mouth line, a more important use is its second function, the following table shows: </p><p> In addition, the P3 mouth also receives some to use in Flash do
22、dging the fast memory programming and the program check control signal.</p><p> RST: Replacement input.When the oscillator works, the RST pin will appear above two machine cycles the high level to cause the
23、 monolithic replacement.</p><p> ALE/PROG: When visits exterior program memory or the data-carrier storage, ALE (address lock saves permission) to output the pulse to use in the lock saving the address the
24、low 8 bytes.In ordinary circumstances, ALE still by clock oscilation frequency 1/6 output fixed pulse signal, therefore it may the foreign output clock or uses in fixed time the goal.Must pay attention: When visits exter
25、ior data-carrier storage will jump over a ALE pulse.</p><p> To Flash memory programming period, this pin also uses in inputting programming pulse (PROG). </p><p> If has the necessity, may th
26、rough to in special function register (SFR) area 8EH the unit D0 position position, be possible to forbid the ALE operation.After this position position, only then MOVX and the MOVC instruction can activate ALE.In additi
27、on, this pin can pull weakly high, when the monolithic integrated circuit carries out exterior procedure, should establish the ALE prohibition position to be invalid</p><p> PSEN: The procedure storage perm
28、its the (PSEN) output is exterior program memory reads the gating signal, when AT89C52 takes the instruction by exterior program memory (or data), each machine cycle two PSEN is effective, namely outputs two pulses.When
29、visits exterior data-carrier storage, will jump over two RSEN signals. </p><p> EA/VPP: Exterior visit permission.Wants to cause CPU only to visit exterior program memory (address is 0000H-FFFFH), the EA en
30、d must maintain the low level (earth).Must pay attention: If adds mil LB1 to program, when replacement the interior can lock saves the EA end condition.</p><p> If the EA end (meets the Vcc end) for the hig
31、h level, CPU carries out in the internal procedure memory instruction.</p><p> When the Flash memory programs, this pin adds on 12V programming permission power source VPP, certainly this must be this compo
32、nent is uses 12V to program voltage VPP.</p><p> XTAL1: Oscillator inverting amplifier and internal clock generator input end.</p><p> XTAL2: Oscillator inverting amplifier out-port. Special f
33、unction register: </p><p> In at89C52 internal memory, the 80H-FFH altogether 128 units for special function register (SFE), SFR address basement reflection as shown in Table 2.</p><p> All ad
34、dresses all are defined by no means, only then a part is defined from the 80H-FFH altogether 128 bytes, but also has quite a part not to define.To the definition unit read-write will not have been Yuan Xiao, the read-out
35、 value will be indefinite, but will read in the data will also lose.</p><p> Should not “1” not read in the data the definition unit, then will possibly entrust with the new function in these units in the f
36、uture product, in this case, after replacement these unit value always “0”. </p><p> AT89C52 besides with AT89C51 all fixed time/counters 0 and fixed time/counter 1, but also increased a fixed time/counter
37、2.Fixed time/the counter 2 control status byte is located T2CON、T2MOD (to see Table 4), the register to (RCA02H, RCAP2L) is the timer 2/automatic loads the register again under 16 capture ways or 16 automatic heavy loadi
38、ng way capture.</p><p> Interrupt register: </p><p> AT89C52 has 6 interrupt sources, 2 interrupt priorities, the IE register controls each interrupt position, in the IP register 6 interrupt s
39、ource each may decide as 2 superior</p><p> data-carrier storages: </p><p> AT89C52 has 256 byte internal RAM,80H-FFH high 128 bytes and the special function register (SFR) address is overlap,
40、 also is high 128 byte RAM and the special function register address is same, but in physics they are separated.</p><p> When an instruction visits the 7FH above dummy home address unit, in the instruction
41、uses the addressing way is different, also is the addressing way decision is visits high 128 byte RAM to visit the special function register.If the instruction is the direct addressing way for the visit special function
42、register.</p><p> For example, following direct addressing instruction visit special function register 0A0H (i.e. P2 mouth) address unit.</p><p> MOV 0A0H,#data</p><p> The indir
43、ect addressing instruction visits high 128 byte RAM, for example, in following indirect addressing instruction, the R0 content is 0A0H, then the visit data byte address is 0A0H, but is not the P2 mouth (0A0H).</p>
44、<p> MOV the @R0,#data</p><p> storehouse operation also is the indirect addressing way, therefore, high 128 bit data RAM also may take the storehouse area use.</p><p> Timer 0 and time
45、r 1:</p><p> The AT89C52 timer 0 and the timer 1 working and AT89C51 are same.</p><p><b> Timer 2:</b></p><p> The timer 2 is 16 fixed time/counters.It already may wh
46、en timer use, also may take the external event counter use, its working chooses by the special function register T2CON C/T2 position.The timer 2 has three workings: The capture way, the automatic heavy loading (upward or
47、 downward counting) the way and the baudrate generator way, the working chooses by the T2CON control position, see also table 4. </p><p> Table 4 timer 2 workings</p><p> The timer 2 is compos
48、ed by two 8 register TH2 and TL2, in the timer working, each machine cycle TL2 register value adds 1, because a machine cycle vibrates the clock constitution by 12, therefore, counting speed for oscilation frequency 1/12
49、.</p><p> When counting working, when on the T2 pin exterior input signal produces by 1 to 0 drops along, the register value adds 1, under this working, each machine cycle 5SP2 period, carries on the sampli
50、ng to exterior input. If picks in the first machine cycle the value is 1, but the value which picks in the next machine cycle is 0, then is following close on the next cyclical S3P1 period register adds 1.Because disting
51、uishes 1 to need 2 machine cycles to 0 jumps (24 durations of oscillation), therefor</p><p> Capture way:</p><p> Under the capture way, chooses two ways through T2CON control position EXEN2.I
52、f EXEN2=0, the timer 2 is 16 timers or the counter, when counting overflow, to the T2CON overflow symbolized TF2 sets at the position, simultaneously activates the interrupt.If looks up EXEN2=1, the timer 2 completes the
53、 same operation, But when the T2EX pin exterior input signal has 1 to 0 negative jumps, also appears in TH2 and the TL2 value is caught separately to in RCAP2H and RCAP2L.Moreover, the T2EX pin signal j</p><p&
54、gt; Automatic heavy loading (upward or downward counter) way: </p><p> When timer 2 work in 16 automatic heavy loading ways, can to its programming for upward or the downward counting way, this function ma
55、y (see Table 5) through special function register T2CON the DCEN position (permission downward counting) choose.When replacement, the DCEN position “0”, the timer 2 defaults establishes as the upward counting. When DCEN
56、sets at the position, the timer 2 already may count upwardly also may the downward counting, this is decided by the T2EX pin value, see also Figur</p><p> When DCEN sets at the position, the timer 2 already
57、 may count upwardly also may the downward counting, this is decided by the T2EX pin value, see also Figure 5, when DCEN=0, the timer 2 automatic setups for the upward counting, under this way, in the T2CON EXEN2 control
58、position have two kind of choices, if EXEN2=0, the timer 2 for the upward counting to the 0FFFFH overflow, sets at the position TF2 activation interrupt, simultaneously 16 counter register RCAP2H and the RCAP2L heavy loa
59、ding, RCA</p><p> Baudrate generator: </p><p> When T2CON (Table 3) TCLK and RCLK set at the position, fixed time/the counter 2 takes the baudrate generator use.If fixed time/the counter 2 too
60、k the transmitter or the receiver, its transmission and the receive baudrate may be different, the timer 1 uses in other functions, as shown in Figure 7.If RCLK and TCLK set at the position, then timer 2 work in baudrate
61、 generator way.</p><p> The baudrate generator way and the automatic heavy loading way are similar, under this way, the TH2 turn over causes the timer 2 registers is important the new loading with in RCAP2H
62、 and the RCAP2L 16 figures, this value establishes by the software.</p><p> In the way 1 and the way in 3, the baudrate determined by the timer 2 overflow speeds according to the equation below that,Way 1 a
63、nd 3 baudrate = timer overflow rate /16</p><p> The timer already can work in fixed time the way also can work in the counting way, in the majority applications, is the work in fixed time the way (C/T2=0).T
64、he timer 2 took when baudrate generator, with as the timer operation is different, when usual achievement timer, (1/12 oscilation frequency) checks the value in each machine cycle to add 1, but took when baudrate generat
65、or use, (1/2 oscilation frequency) the register value adds 1 in each condition time. The baudrate formula is as follows:</p><p> The way 1 and 3 baudrate = oscilation frequency/{32×[65536-(RCAP2H, RCAP
66、2L)]}</p><p> in the formula (RCAP2H, RCAP2L) is in RCAP2H and RCAP2L 16 does not have the sign digit.</p><p> The timer 2 took the baudrate generator use electric circuit as shown in Figure 7
67、.In when T2CON RCLK or TCLK=1, the baudrate working only then is effective. In the baudrate generator working, the TH2 turn over cannot cause TF2 to set at the position, therefore does not have the interrupt.But if EXEN2
68、 sets at the position, also the T2EX end produces by 1 to 0 negative jumps, then can cause EXF2 to set at the position, this time cannot load (RCAP2H, RCAP2L) content in TH2 and TL2.Therefore, when t</p><p>
69、 But however, may read to RCAP2 cannot write, because the write operation will be the reload, the write operation possibly command writes with/or the heavy loading makes a mistake.In visits timer 2 or in front of the RC
70、AP2 register, should (eliminate the timer closure TR2).</p><p> The programmable clock outputs: </p><p> The timer 2 may output a dutyfactor through the programming from P1.0 is 50% clock sign
71、al, as shown in Figure 8.The P1.0 pin besides is a standard I/O mouth, but also may cause it through the programming to take fixed time/the counter 2 exterior clock inputs and the output dutyfactor 50% clock pulse.When t
72、he clock oscilation frequency is 16MHz, outputs the clock frequency range is 61Hz-4MHz.</p><p> When establishes fixed time/the counter 2 as the clock generator, C/T2(T2CON.1)=0, T2OE(T2MOD.1)=1, must or st
73、ops the timer by TR2(T2CON.2) start.The clock output frequency is decided in the oscilation frequency and the timer 2 catches the register (RCAP2H, RCAP2L) reload value, the formula is as follows:</p><p> T
74、he output clock frequency = oscillator frequency/{4×[65536-(RCAP2H, RCAP2L)]}</p><p> under the clock output way, the timer 2 turn over cannot have the interrupt, this characteristic with took when bau
75、drate generator use is similar.When the timer 2 takes the baudrate generator use, Also may take the clock generator use, but needs to pay attention is the baudrate and the clock output frequency cannot separate the deter
76、mination, this is because they with use RCAP2H and RCAP2L.</p><p> AT89C52單片機的介紹</p><p> AT89C52是美國ATMEL公司生產(chǎn)的低電壓,高性能CMOS 8位單片機,片內(nèi)含8k bytes的可反復擦寫的只讀程序存儲器(PEROM)和256bytes的隨機存取數(shù)據(jù)存儲器(RAM
77、),器件采用ATMEL公司的高密度、非易失性存儲技術生產(chǎn),與標準MCS-51指令系統(tǒng)及8052產(chǎn)品引腳兼容,片內(nèi)置通用8位中央處理器(CPU)和Flash存儲單元,功能強大AT89C52單片機適合于許多較為復雜控制應用場合。</p><p><b> 功能特性概述:</b></p><p> AT89C52提供以下標準功能:8k字節(jié)Flash閃速存儲器,256字節(jié)
78、內(nèi)部RAM,32個I/O口線,3個16位定時/計數(shù)器,一個6向量兩級中斷結構,一個全雙工串行通信口,片內(nèi)振蕩器及時鐘電路。同時,AT89C52可降至0HZ的靜態(tài)邏輯操作,并支持兩種軟件可選的節(jié)電工作模式??臻e方式停止CPU的工作,但允許RAM,定時/計數(shù)器,串行通信口及中斷系統(tǒng)繼續(xù)工作。掉電方式保存RAM中的內(nèi)容,但振蕩器停止工作并禁止其它所有部件工作直到下一個硬件復位。</p><p><b> 引
79、腳功能說明 </b></p><p><b> Vcc:電源電壓 </b></p><p><b> GND:地線 </b></p><p> P0口:P0口是一組8位漏極開路型雙向I/O口,也即地址/數(shù)據(jù)總線復用口。作為輸出口用時,每位能吸收電流的方式驅(qū)動8個TTL邏輯門電路,對端口P0寫“1”時,可作
80、為高阻抗輸入端用。 </p><p> 在訪問外部數(shù)據(jù)存儲器或程序存儲器時,這組口線分時轉(zhuǎn)換地址(低8位)和數(shù)據(jù)總線復用,在訪問期間激活內(nèi)部上拉電阻。 </p><p> 在Flash編程時,P0口接收指令字節(jié),而在程序校驗時,輸出指令字節(jié),校驗時,要求外接上拉電阻</p><p> P1口:P1是一個帶內(nèi)部上拉電阻的8位雙向I/O口,P1的輸出緩沖級可驅(qū)動(
81、吸收或輸出電流)4個TTL邏輯門電路。對端口寫“1”,通過內(nèi)部的上拉電阻把端口拉到高電平,此時可作輸入口。作輸入口使用時,因為內(nèi)部存在上拉電阻,某個引腳被外部信號拉低時會輸出一個電流(IIL)。</p><p> 與AT89C51不同之處是,P1.0和P1.1還可分別作為定時/計數(shù)器2的外部計數(shù)輸入(P1.0/T2)和輸入(P1.1/T2EX),參見表1。 </p><p> Flas
82、h編程和程序校驗期間,P1接收低8位地址。</p><p> 表1 P1.0和P1.1的第二功能</p><p> P2口:P2是一個帶有內(nèi)部上拉電阻的8位雙向I/O口,P2的輸出緩沖級可驅(qū)動(吸收或輸出電流)4個TTL邏輯門電路。對端口P2寫“1”,通過內(nèi)部的上拉電阻把端口拉到高電平,此時可作輸入口,作輸入口使用時,因為內(nèi)部存在上拉電阻,某個引腳被外部信號拉低時會輸出一個電流(IIL
83、)。</p><p> 在訪問外部程序存儲器或16位地址的外部數(shù)據(jù)存儲器(例如執(zhí)行MOVX@DPTR指令)時,P2口送出高8位地址數(shù)據(jù)。在訪問8位地址的外部數(shù)據(jù)存儲器(如執(zhí)行MOVX@RI指令)時,P2口輸出P2鎖存器的內(nèi)容</p><p> Flash編程或校驗時,P2亦接收高位地址和一些控制信號。</p><p> P3口:P3口是一組帶有內(nèi)部上拉電阻的8
84、位雙向I/O口。P3口輸出緩沖級可驅(qū)動(吸收或輸出電流)4個TTL邏輯門電路。對P3口寫入“1”時,它們被內(nèi)部上位電阻拉高并可作為輸入端口。此時,被外部拉低的P3口將用上拉電阻輸出電流(IIL)。</p><p> P3口除了作為一般的I/O口線外,更重要的用途是它的第二功能,如下表所示: </p><p> 此外,P3口還接收一些用于Flash閃速存儲器編程和程序校驗的控制信號。&l
85、t;/p><p> RST:復位輸入。當振蕩器工作時,RST引腳出現(xiàn)兩個機器周期以上高電平將使單片復位。</p><p> ALE/PROG:當訪問外部程序存儲器或數(shù)據(jù)存儲器時,ALE(地址鎖存允許)輸出脈沖用于鎖存地址的低8位字節(jié)。一般情況下,ALE仍以時鐘振蕩頻率的1/6輸出固定的脈沖信號,因此它可對外輸出時鐘或用于定時目的。要注意的是:每當訪問外部數(shù)據(jù)存儲器時將跳過一個ALE脈沖。
86、</p><p> 對Flash存儲器編程期間,該引腳還用于輸入編程脈沖(PROG)。 </p><p> 如有必要,可通過對特殊功能寄存器(SFR)區(qū)中的8EH單元的D0位置位,可禁止ALE操作。該位置位后,只有一條MOVX和MOVC指令才能將ALE激活。此外,該引腳會被微弱拉高,單片機執(zhí)行外部程序時,應設置ALE禁止位無效</p><p> PSEN:程序
87、儲存允許(PSEN)輸出是外部程序存儲器的讀選通信號,當AT89C52由外部程序存儲器取指令(或數(shù)據(jù))時,每個機器周期兩次PSEN有效,即輸出兩個脈沖。在此期間,當訪問外部數(shù)據(jù)存儲器,將跳過兩次RSEN信號。 </p><p> EA/VPP:外部訪問允許。欲使CPU僅訪問外部程序存儲器(地址為0000H-FFFFH),EA端必須保持低電平(接地)。需注意的是:如果加密位LB1被編程,復位時內(nèi)部會鎖存EA端狀態(tài)
88、。</p><p> 如EA端為高電平(接Vcc端),CPU則執(zhí)行內(nèi)部程序存儲器中的指令。</p><p> Flash存儲器編程時,該引腳加上+12V的編程允許電源VPP,當然這必須是該器件是使用12V編程電壓VPP。</p><p> XTAL1:振蕩器反相放大器的及內(nèi)部時鐘發(fā)生器的輸入端。</p><p> XTAL2:振蕩器反
89、相放大器的輸出端。</p><p><b> 特殊功能寄存器:</b></p><p> AT89C52片內(nèi)存儲器中,80H-FFH共128個單元為特殊功能寄存器(SFE),SFR的地址窨映象如表2所示。</p><p> 并非所有的地址都被定義,從80H-FFH共128個字節(jié)只有一部分被定義,還有相當一部分沒有定義。對沒有定義的單元讀寫
90、將是元效的,讀出的數(shù)值將不確定,而寫入的數(shù)據(jù)也將丟失。</p><p> 不應將數(shù)據(jù)“1”寫入未定義的單元,則于這些單元在將來的產(chǎn)品中可能賦予新的功能,在這種情況下,復位后這些單元數(shù)值總是“0”。</p><p> AT89C52除了與AT89C51所有的定時/計數(shù)器0和定時/計數(shù)器1外,還增加了一個定時/計數(shù)器2。定時/計數(shù)器2的控制狀態(tài)位位于T2CON、T2MOD(見表4),寄存器
91、對(RCA02H、RCAP2L)是定時器2在16位捕獲方式或16位自動重裝載方式下的捕獲/自動重裝載寄存器。</p><p><b> 中斷寄存器:</b></p><p> AT89C52有6個中斷源,2個中斷優(yōu)先級,IE寄存器控制各中斷位,IP寄存器中6個中斷源的每一個可定為2個優(yōu)</p><p><b> 數(shù)據(jù)存儲器:&l
92、t;/b></p><p> AT89C52有256個字節(jié)的內(nèi)部RAM,80H-FFH高128個字節(jié)與特殊功能寄存器(SFR)地址是重疊的,也就是高128字節(jié)的RAM和特殊功能寄存器的地址是相同的,但物理上它們是分開的。</p><p> 當一條指令訪問7FH以上的內(nèi)部地址單元時,指令中使用的尋址方式是不同的,也即尋址方式?jīng)Q定是訪問高128字節(jié)RAM還是訪問特殊功能寄存器。如果指
93、令是直接尋址方式則為訪問特殊功能寄存器。</p><p> 例如,下面的直接尋址指令訪問特殊功能寄存器0A0H(即P2口)地址單元。</p><p> MOV 0A0H,#data</p><p> 間接尋址指令訪問高128字節(jié)RAM,例如,下面的間接尋址指令中,R0的內(nèi)容為0A0H,則訪問數(shù)據(jù)字節(jié)地址為0A0H,而不是P2口(0A0H)。</p>
94、<p> MOV?。繰0,#data</p><p> 堆棧操作也是間接尋址方式,所以,高128位數(shù)據(jù)RAM亦可作為堆棧區(qū)使用。</p><p> 定時器0和定時器1:</p><p> AT89C52的定時器0和定時器1的工作方式與AT89C51相同。</p><p><b> 定時器2:</b>
95、;</p><p> 定時器2是一個16位定時/計數(shù)器。它既可當定時器使用,也可作為外部事件計數(shù)器使用,其工作方式由特殊功能寄存器T2CON的C/T2位選擇。定時器2有三種工作方式:捕獲方式,自動重裝載(向上或向下計數(shù))方式和波特率發(fā)生器方式,工作方式由T2CON的控制位來選擇,參見表4。</p><p> 表4 定時器2工作方式</p><p> 定時器2由
96、兩個8位寄存器TH2和TL2組成,在定時器工作方式中,每個機器周期TL2寄存器的值加1,由于一個機器周期由12個振蕩時鐘構成,因此,計數(shù)速率為振蕩頻率的1/12。</p><p> 在計數(shù)工作方式時,當T2引腳上外部輸入信號產(chǎn)生由1至0的下降沿時,寄存器的值加1,在這種工作方式下,每個機器周期的5SP2期間,對外部輸入進行采樣。若在第一個機器周期中采到的值為1,而在下一個機器周期中采到的值為0,則在緊跟著的下一
97、個周期的S3P1期間寄存器加1。由于識別1至0的跳變需要2個機器周期(24個振蕩周期),因此,最高計數(shù)速率為振蕩頻率的1/24。為確保采樣的正確性,要求輸入的電平在變化前至少保持一個完整周期的時間,以保證輸入信號至少被采樣一次。</p><p><b> 捕獲方式:</b></p><p> 在捕獲方式下,通過T2CON控制位EXEN2來選擇兩種方式。如果EXEN
98、2=0,定時器2是一個16位定時器或計數(shù)器,計數(shù)溢出時,對T2CON的溢出標志TF2置位,同時激活中斷。如查EXEN2=1,定時器2完成相同的操作,而當T2EX引腳外部輸入信號發(fā)生1至0負跳變時,也出現(xiàn)TH2和TL2中的值分別被捕獲到RCAP2H和RCAP2L中。另外,T2EX引腳信號的跳變使得T2CON中的EXF2置位,與TF2相仿,EXF2也會活中斷。捕獲方式如圖4所示。</p><p> 自動重裝載(向上
99、或向下計數(shù)器)方式:</p><p> 當定時器2工作于16位自動重裝載方式時,能對其編程為向上或向下計數(shù)方式,這個功能可通過特殊功能寄存器T2CON(見表5)的DCEN位(允許向下計數(shù))來選擇的。復位時,DCEN位置“0”,定時器2默認設置為向上計數(shù)。當DCEN置位時,定時器2既可向上計數(shù)也可向下計數(shù),這取決于T2EX引腳的值,參見圖5,當DCEN=0時,定時器2自動設置為向上計數(shù),在這種方式下,T2CON中
100、的EXEN2控制位有兩種選擇,若EXEN2=0,定時器2為向上計數(shù)至0FFFFH溢出,置位TF2激活中斷,同時把16位計數(shù)寄存器RCAP2H和RCAP2L重裝載,RCAP2H和RCAP2L的值可由軟件預置。若EXEN2=1,定時器2的16位重裝載由溢出或外部輸入端T2EX從1至0的下降沿觸發(fā)。這個脈沖使EXF2置位,如果中斷允許,同樣產(chǎn)生中斷。</p><p> 當DCEN=1時,允許定時器2向上或向下計數(shù),如
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- at89c52單片機簡介外文翻譯
- at89c52 的介紹【外文翻譯】
- 外文翻譯--基于at89c52單片機led顯示屏系統(tǒng)設計
- 基于at89c52單片機的小區(qū)門禁系統(tǒng)
- 單片機外文翻譯 ----at89c51單片機介紹
- 外文翻譯--基于at89c52單片機led顯示屏系統(tǒng)設計(英文)
- at89c52單片機控制交通燈系統(tǒng)
- 基于at89c52單片機的轉(zhuǎn)速測量系統(tǒng)設計
- 基于at89c52單片機的數(shù)字時鐘系統(tǒng)設計
- 基于at89c52單片機的光功率計設計
- 基于at89c52單片機的sd卡讀寫設計
- 單片機外文翻譯--at89s52單片機
- 單片機外文翻譯---at89s52單片機
- 外文翻譯--at89c51單片機的介紹
- 基于at89c52單片機的交通燈控制系統(tǒng)的設計(外文翻譯)
- 外文翻譯--基于at89c52單片機led顯示屏控制系統(tǒng)設計
- 基于at89c52單片機的智能報警系統(tǒng)的設計
- 基于at89c52單片機的智能報警系統(tǒng)的設計
- 基于at89c52單片機的智能報警系統(tǒng)的設計
- 51單片機AT89C52中文資料.doc
評論
0/150
提交評論