電氣控制工程外文翻譯_第1頁
電氣控制工程外文翻譯_第2頁
電氣控制工程外文翻譯_第3頁
電氣控制工程外文翻譯_第4頁
電氣控制工程外文翻譯_第5頁
已閱讀5頁,還剩6頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、.附錄附錄1 外文文獻(xiàn)C8051F020 (PORT INPUT/OUTPUT)The C8051F020/1/2/3 are fully integrated mixed-signal System on a Chip MCUs with 64 digital I/O pins (C8051F020/2) or 32 digital I/O pins (C8051F021/3), organized as 8-bit Ports. The lower ports: P0, P1, P2, and P3, are both bit- and byte-addressable through t

2、heir corresponding Port Data registers. The upper ports: P4, P5, P6, and P7 are byte-addressable. All Port pins are 5 V-tolerant, and all support configurable Open-Drain or Push-Pull output modes and weak pull-ups. The C8051F020/1/2/3 devices have a wide array of digital resources which are availabl

3、e through the four lower I/O Ports: P0, P1, P2, and P3. Each of the pins on P0, P1, P2, and P3, can be defined as a General-Purpose I/O (GPIO) pin or can be controlled by a digital peripheral or function (like UART0 or /INT1 for example), as shown in Figure 17.2. The system designer controls which d

4、igital functions are assigned pins, limited only by the number of pins available. This resource assignment flexibility is achieved through the use of a Priority Crossbar Decoder. Note that the state of a Port I/O pin can always be read from its associated Data register regardless of whether that pin

5、 has been assigned to a digital peripheral or behaves as GPIO. The Port pins on Port1 can be used as Analog Inputs to ADC1.The Priority Crossbar Decoder, or “Crossbar”, allocates and assigns Port pins on Port 0 through Port 3 to the digital peripherals (UARTs, SMBus, PCA, Timers, etc.) on the device

6、 using a priority order. The Port pins are allocated in order starting with P0.0 and continue through P3.7 if necessary. The digital peripherals are assigned Port pins in a priority order which is listed in Figure 17.3, with UART0 having the highest priority and CNVSTR having the lowest priority.The

7、 Crossbar assigns Port pins to a peripheral if the corresponding enable bits of the peripheral are set to a logic 1 in the Crossbar configuration registers XBR0, XBR1, and XBR2, shown in Figure 17.7, Figure 17.8, and Figure 17.9. For example, if the UART0EN bit (XBR0.2) is set to a logic 1, the TX0

8、and RX0 pins will be mapped to P0.0 and P0.1 respectively. Because UART0 has the highest priority, its pins will always be mapped to P0.0 and P0.1 when UART0EN is set to a logic 1. If a digital peripherals enable bits are not set to a logic 1, then its ports are not accessible at the Port pins of th

9、e device. Also note that the Crossbar assigns pins to all associated functions when a serial communication peripheral is selected (i.e. SMBus, SPI, UART). It would be impossible, for example, to assign TX0 to a Port pin without assigning RX0 as well. Each combination of enabled peripherals results i

10、n a unique device pinout.All Port pins on Ports 0 through 3 that are not allocated by the Crossbar can be accessed as General-Purpose I/O (GPIO) pins by reading and writing the associated Port Data registers ,a set of SFRs which are both byte- and bit-addressable. The output states of Port pins that

11、 are allocated by the Crossbar are controlled by the digital peripheral that is mapped to those pins. Writes to the Port Data registers (or associated Port bits) will have no effect on the states of these pins.A Read of a Port Data register (or Port bit) will always return the logic state present at

12、 the pin itself, regardless of whether the Crossbar has allocated the pin for peripheral use or not. An exception to this occurs during the execution of a read-modify-write instruction (ANL, ORL, XRL, CPL, INC, DEC, DJNZ, JBC, CLR, SET, and the bitwise MOV operation). During the read cycle of the re

13、ad-modify-write instruction, it is the contents of the Port Data register, not the state of the Port pins themselves, which is read.Because the Crossbar registers affect the pinout of the peripherals of the device, they are typically configured in the initialization code of the system before the per

14、ipherals themselves are configured. Once configured, the Crossbar registers are typically left alone.Once the Crossbar registers have been properly configured, the Crossbar is enabled by setting XBARE (XBR2.6) to a logic 1. Until XBARE is set to a logic 1, the output drivers on Ports 0 through 3 are

15、 explicitly disabled in order to prevent possible contention on the Port pins while the Crossbar registers and other registers which can affect the device pinout are being written.The output drivers on Crossbar-assigned input signals (like RX0, for example) are explicitly disabled; thus the values o

16、f the Port Data registers and the PnMDOUT registers have no effect on the states of these pins.The output drivers on Ports 0 through 3 remain disabled until the Crossbar is enabled by setting XBARE (XBR2.6) to a logic 1.The output mode of each port pin can be configured as either Open-Drain or Push-

17、Pull; the default state is Open-Drain. In the Push-Pull configuration, writing a logic 0 to the associated bit in the Port Data register will cause the Port pin to be driven to GND, and writing a logic 1 will cause the Port pin to be driven to VDD. In the Open-Drain configuration, writing a logic 0

18、to the associated bit in the Port Data register will cause the Port pin to be driven to GND, and a logic 1 will cause the Port pin to assume a high-impedance state. The Open-Drain configuration is useful to prevent contention between devices in systems where the Port pin participates in a shared int

19、erconnection in which multiple outputs are connected to the same physical wire (like the SDA signal on an SMBus connection).The output modes of the Port pins on Ports 0 through 3 are determined by the bits in the associated PnMDOUT registers (See Figure 17.11, Figure 17.14, Figure 17.16, and Figure

20、17.18). For example, a logic 1 in P3MDOUT.7 will configure the output mode of P3.7 to Push-Pull; a logic 0 in P3MDOUT.7 will configure the output mode of P3.7 to Open-Drain. All Port pins default to Open-Drain output.The PnMDOUT registers control the output modes of the port pins regardless of wheth

21、er the Crossbar has allocated the Port pin for a digital peripheral or not. The exceptions to this rule are: the Port pins connected to SDA, SCL, RX0 (if UART0 is in Mode 0), and RX1 (if UART1 is in Mode 0) are always configured as Open-Drain outputs, regardless of the settings of the associated bit

22、s in the PnMDOUT registers.A Port pin is configured as a digital input by setting its output mode to “Open-Drain” and writing a logic 1 to the associated bit in the Port Data register. For example, P3.7 is configured as a digital input by setting P3MDOUT.7 to a logic 0 and P3.7 to a logic 1.If the P

23、ort pin has been assigned to a digital peripheral by the Crossbar and that pin functions as an input (for example RX0, the UART0 receive pin), then the output drivers on that pin are automatically disabled.In addition to the external interrupts /INT0 and /INT1, whose Port pins are allocated and assi

24、gned by the Crossbar, P3.6 and P3.7 can be configured to generate edge sensitive interrupts; these interrupts are configurable as falling- or rising-edge sensitive using the IE6CF (P3IF.2) and IE7CF (P3IF.3) bits. When an active edge is detected on P3.6 or P3.7, a corresponding External Interrupt fl

25、ag (IE6 or IE7) will be set to a logic 1 in the P3IF register (See Figure 17.19). If the associated interrupt is enabled, an interrupt will be generated and the CPU will vector to the associated interrupt vector location. See Section “12.3. Interrupt Handler” on page 116 for more information about i

26、nterrupts.By default, each Port pin has an internal weak pull-up device enabled which provides a resistive connection (about 100 k兦) between the pin and VDD. The weak pull-up devices can be globally disabled by writing a logic 1 to the Weak Pull-up Disable bit, (WEAKPUD,XBR2.7). The weak pull-up is

27、automatically deactivated on any pin that is driving a logic 0; that is, an output pin will not contend with its own pull-up device. The weak pull-up device can also be explicitly disabled on a Port 1 pin by configuring the pin as an Analog Input, as described below.The pins on Port 1 can serve as a

28、nalog inputs to the ADC1 analog MUX. A Port pin is configured as an Analog Input by writing a logic 0 to the associated bit in the P1MDIN register (see Figure 17.13). All Port pins default to a Digital Input mode. Configuring a Port pin as an analog input:1.Disables the digital input path from the p

29、in. This prevents additional power supply current from being drawn when the voltage at the pin is near VDD / 2. A read of the Port Data bit will return a logic 0 regardless of the voltage at the Port pin.2.Disables the weak pull-up device on the pin.3.Causes the Crossbar to “skip over” the pin when

30、allocating Port pins for digital peripherals.If the External Memory Interface (EMIF) is enabled on the Low ports (Ports 0 through 3), EMIFLE (XBR2.1) should be set to a logic 1 so that the Crossbar will not assign peripherals to P0.7 (/WR), P0.6 (/RD), and if the External Memory Interface is in Mult

31、iplexed mode, P0.5 (ALE).If the External Memory Interface is enabled on the Low ports and an off-chip MOVX operation occurs, the External Memory Interface will control the output states of the affected Port pins during the execution phase of the MOVX instruction, regardless of the settings of the Cr

32、ossbar registers or the Port Data registers. The output configuration of the Port pins is not affected by the EMIF operation, except that Read operations will explicitly disable the output drivers on the Data Bus.In this example, we configure the Crossbar to allocate Port pins for UART0, the SMBus,

33、UART1, /INT0, and /INT1 (8 pins total). Additionally, we configure the External Memory Interface to operate in Multiplexed mode and to appear on the Low ports. Further, we configure P1.2, P1.3, and P1.4 for Analog Input mode so that the voltages at these pins can be measured by ADC1. The configurati

34、on steps are as follows:1.XBR0, XBR1, and XBR2 are set such that UART0EN = 1, SMB0EN = 1, INT0E = 1, INT1E = 1, and EMIFLE = 1. Thus: XBR0 = 0x05, XBR1 = 0x14, and XBR2 = 0x02.2.We configure the External Memory Interface to use Multiplexed mode and to appear on the Low ports. PRTSEL = 0, EMD2 = 0.3.

35、We configure the desired Port 1 pins to Analog Input mode by setting P1MDIN to 0xE3 (P1.4, P1.3, and P1.2 are Analog Inputs, so their associated P1MDIN bits are set to logic 0).4.We enable the Crossbar by setting XBARE = 1: XBR2 = 0x46.-UART0 has the highest priority, so P0.0 is assigned to TX0, and

36、 P0.1 is assigned to RX0.-The SMBus is next in priority order, so P0.2 is assigned to SDA, and P0.3 is assigned to SCL.-UART1 is next in priority order, so P0.4 is assigned to TX1. Because the External Memory Interface is selected on the lower Ports, EMIFLE = 1, which causes the Crossbar to skip P0.

37、6 (/RD) and P0.7 (/WR). Because the External Memory Interface is configured in Multiplexed mode, the Crossbar will also skip P0.5 (ALE). RX1 is assigned to the next non-skipped pin, which in this case is P1.0.-/INT0 is next in priority order, so it is assigned to P1.1.-P1MDIN is set to 0xE3, which c

38、onfigures P1.2, P1.3, and P1.4 as Analog Inputs, causing the Crossbar to skip these pins.-/INT1 is next in priority order, so it is assigned to the next non-skipped pin, which is P1.5.-The External Memory Interface will drive Ports 2 and 3 (denoted by red dots in Figure 17.6) during the execution of

39、 an off-chip MOVX instruction.5.We set the UART0 TX pin (TX0, P0.0), UART1 TX pin (TX1, P0.4), ALE, /RD, /WR (P0.7:3) outputs to Push-Pull by setting P0MDOUT = 0xF1.6.We configure the output modes of the EMIF Ports (P2, P3) to Push-Pull by setting P2MDOUT = 0xFF and P3MDOUT = 0xFF.7.We explicitly di

40、sable the output drivers on the 3 Analog Input pins by setting P1MDOUT = 0x00 (configure outputs to Open-Drain) and P1 = 0xFF (a logic 1 selects the high-impedance state).附錄2 文獻(xiàn)翻譯C8051F020 (端口輸入/輸出)C8051F020/1/2/3 MCU 是高集成度的混合信號片上系統(tǒng),有按8 位端口組織的64 個數(shù)字I/O 引腳(C8051F020/2)或32 個數(shù)字I/O 引腳(C8051F021/3)。低端口(P

41、0、P1、P2 和P3)既可以按位尋址也可以按字節(jié)尋址。高端口(P4、P5、P6 和P7)只能按字節(jié)尋址。所有引腳都耐5V 電壓,都可以被配置為漏極開路或推挽輸出方式和弱上拉。C8051F020/1/2/3 器件有大量的數(shù)字資源需要通過4 個低端I/O 端口P0、P1、P2 和P3 才能使用。P0、P1、P2 和P3 中的每個引腳既可定義為通用的端口I/O(GPIO)引腳,又可以分配給一個數(shù)字外設(shè)或功能(例如:UART0 或/INT1)。系統(tǒng)設(shè)計(jì)者控制數(shù)字功能的引腳分配,只受可用引腳數(shù)的限制。這種資源分配的靈活性是通過使用優(yōu)先權(quán)交叉開關(guān)譯碼器實(shí)現(xiàn)的。注意,不管引腳被分配給一個數(shù)字外設(shè)或是作為通

42、用I/O,總是可以通過讀相應(yīng)的數(shù)據(jù)寄存器得到端口I/O 引腳的狀態(tài)。端口1 的引腳可以用做ADC1 的模擬輸入。優(yōu)先權(quán)交叉開關(guān)譯碼器,或稱為“交叉開關(guān)”,按優(yōu)先權(quán)順序?qū)⒍丝? 3 的引腳分配給器件上的數(shù)字外設(shè)(UART、SMBus、PCA、定時器等)。端口引腳的分配順序是從P0.0 開始,可以一直分配到P3.7。為數(shù)字外設(shè)分配端口引腳的優(yōu)先權(quán)順序列于圖17.3,UART0 具有最高優(yōu)先權(quán),而CNVSTR 具有最低優(yōu)先權(quán)。當(dāng)交叉開關(guān)配置寄存器XBR0、XBR1 和XBR2 中外設(shè)的對應(yīng)使能位被設(shè)置為邏輯1時,交叉開關(guān)將端口引腳分配給外設(shè),如圖17.7、圖17.8 和圖17.9 所示。例如,如果U

43、ART0EN位(XBR0.2)被設(shè)置為邏輯1,則TX0 和RX0 引腳將分別被分配到P0.0 和P0.1。因?yàn)閁ART0有最高優(yōu)先權(quán),所以當(dāng)UART0EN 位被設(shè)置為邏輯1時其引腳將總是被分配到P0.0 和P0.1。如果一個數(shù)字外設(shè)的使能位未被設(shè)置為邏輯1,則其端口將不能通過器件的端口引腳被訪問。注意:當(dāng)選擇了串行通信外設(shè)(即SMBus、SPI 或UART)時,交叉開關(guān)將為所有相關(guān)功能分配引腳。例如,不能為UART0 功能只分配TX0 引腳而不分配RX0 引腳。被使能的外設(shè)的每種組合導(dǎo)致唯一的器件引腳分配。端口0-3 中所有未被交叉開關(guān)分配的引腳都可以作為通用I/O(GPI/O)引腳,通過讀或

44、寫相應(yīng)的端口數(shù)據(jù)寄存器訪問,這是一組既可以按位尋址也可以按字節(jié)尋址的SFR。被交叉開關(guān)分配的那些端口引腳的輸出狀態(tài)受使用這些引腳的數(shù)字外設(shè)的控制。向端口數(shù)據(jù)寄存器(或相應(yīng)的端口位)寫入時對這些引腳的狀態(tài)沒有影響。不管交叉開關(guān)是否將引腳分配給外設(shè),讀一個端口數(shù)據(jù)寄存器(或端口位)將總是返回引腳本身的邏輯狀態(tài)。唯一的例外發(fā)生在執(zhí)行讀-修改-寫指令(ANL、ORL、XRL、CPL、INC、DEC、DJNZ、JBC、CLR、SET 和位寫操作)期間。在讀-修改-寫指令的讀周期,所讀的值是端口數(shù)據(jù)寄存器的內(nèi)容,而不是端口引腳本身的狀態(tài)。因?yàn)榻徊骈_關(guān)寄存器影響器件外設(shè)的引腳分配,所以它們通常在外設(shè)被配置前

45、由系統(tǒng)的初試化代碼配置。一旦配置完畢,將不再對其重新編程。交叉開關(guān)寄存器被正確配置后,通過將XBARE(XBR2.6)設(shè)置為邏輯1來使能交叉開關(guān)。在XBARE 被設(shè)置為邏輯1之前,端口0-3 的輸出驅(qū)動器應(yīng)被明確禁止,以防止對交叉開關(guān)寄存器和其它寄存器寫入時在端口引腳上產(chǎn)生爭用。被交叉開關(guān)分配給輸入信號(例如RX0)的引腳所對應(yīng)的輸出驅(qū)動器應(yīng)被明確禁止;以保證端口數(shù)據(jù)寄存器和PnMDOUT 寄存器的值不影響這些引腳的狀態(tài)。在XBARE(XBR2.6)被設(shè)置為邏輯1之前,端口0-3 的輸出驅(qū)動器保持禁止?fàn)顟B(tài)。每個端口引腳的輸出方式都可被配置為漏極開路或推挽方式,缺省狀態(tài)為漏極開路。在推挽方式,向

46、端口數(shù)據(jù)寄存器中的相應(yīng)位寫邏輯0將使端口引腳被驅(qū)動到GND,寫邏輯1將使端口引腳被驅(qū)動到VDD。在漏極開路方式,向端口數(shù)據(jù)寄存器中的相應(yīng)位寫邏輯0將使端口引腳被驅(qū)動到GND,寫邏輯1將使端口引腳處于高阻狀態(tài)。當(dāng)系統(tǒng)中不同器件的端口引腳有共享連接,即多個輸出連接到同一個物理線時(例如SMBus 連接中的SDA 信號),使用漏極開路方式可以防止不同器件之間的爭用。端口0-3 引腳的輸出方式由PnMDOUT 寄存器中的對應(yīng)位決定。例如P3MDOUT.7 為邏輯1時將P3.7 配置為推挽方式;P3MDOUT.7為邏輯0時將P3.7 配置為漏極開路方式。所有端口引腳的缺省方式均為漏極開路。不管交叉開關(guān)是

47、否將端口引腳分配給某個數(shù)字外設(shè),端口引腳的輸出方式都受PnMDOUT寄存器控制。例外情況是:連接到SDA、SCL、RX0(如果UART0 工作于方式0)、RX1(如果UART1 工作于方式0)的端口引腳總是被配置為漏極開路輸出,而與PnMDOUT 寄存器中的對應(yīng)位的設(shè)置值無關(guān)。通過設(shè)置輸出方式為“漏極開路”并向端口數(shù)據(jù)寄存器中的相應(yīng)位寫1將端口引腳配置為數(shù)字輸入。例如,設(shè)置P3MDOUT.7 為邏輯0并設(shè)置P3.7 為邏輯1即可將P3.7 配置為數(shù)字輸入。如果一個端口引腳被交叉開關(guān)分配給某個數(shù)字外設(shè),并且該引腳的功能為輸入(例如UART0 的接收引腳RX0),則該引腳的輸出驅(qū)動器被自動禁止。除了外部中斷/INT0和/INT1(其引腳由交叉開關(guān)分配)之外,P3.6和P3.7可被配置為邊沿觸發(fā)的中斷源,用IE6CF(P3IF.2)和IE7CF(P3IF.3)位可以將這兩個中斷源配置為下降沿或上升沿觸發(fā)。當(dāng)檢測到P3.6或P3.7有下降沿或上升沿發(fā)生時,P3IF寄存器(見圖4.36)中對應(yīng)的外部中斷標(biāo)志(IE6或IE7)將被置1。如果對應(yīng)的中斷被允許,將會產(chǎn)生一個中斷,CPU將轉(zhuǎn)向?qū)?yīng)的中斷向量地址。每個端口引腳都有一個內(nèi)部弱上拉部件,在引腳與VDD 之間提供阻性連接(約100 k),在缺省情況下該上拉器件被使能。弱上拉部件可以被總體禁止,通

溫馨提示

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

評論

0/150

提交評論