电气控制工程外文翻译.docx_第1页
电气控制工程外文翻译.docx_第2页
电气控制工程外文翻译.docx_第3页
电气控制工程外文翻译.docx_第4页
电气控制工程外文翻译.docx_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

附录附录1 外文文献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 their 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 available 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 digital 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 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 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 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 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 the 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 in 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 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 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 read-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 peripherals 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 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 of 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-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 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 interconnection 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 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 whether 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 bits 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 Port 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 assigned 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 flag (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 interrupts.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 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 analog 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 pin. 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 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 Multiplexed 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 Crossbar 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, 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 configuration 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.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 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.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 configures 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 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 disable 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 文献翻译C8051F020 (端口输入/输出)C8051F020/1/2/3 MCU 是高集成度的混合信号片上系统,有按8 位端口组织的64 个数字I/O 引脚(C8051F020/2)或32 个数字I/O 引脚(C8051F021/3)。低端口(P0、P1、P2 和P3)既可以按位寻址也可以按字节寻址。高端口(P4、P5、P6 和P7)只能按字节寻址。所有引脚都耐5V 电压,都可以被配置为漏极开路或推挽输出方式和弱上拉。C8051F020/1/2/3 器件有大量的数字资源需要通过4 个低端I/O 端口P0、P1、P2 和P3 才能使用。P0、P1、P2 和P3 中的每个引脚既可定义为通用的端口I/O(GPIO)引脚,又可以分配给一个数字外设或功能(例如:UART0 或/INT1)。系统设计者控制数字功能的引脚分配,只受可用引脚数的限制。这种资源分配的灵活性是通过使用优先权交叉开关译码器实现的。注意,不管引脚被分配给一个数字外设或是作为通用I/O,总是可以通过读相应的数据寄存器得到端口I/O 引脚的状态。端口1 的引脚可以用做ADC1 的模拟输入。优先权交叉开关译码器,或称为“交叉开关”,按优先权顺序将端口0 3 的引脚分配给器件上的数字外设(UART、SMBus、PCA、定时器等)。端口引脚的分配顺序是从P0.0 开始,可以一直分配到P3.7。为数字外设分配端口引脚的优先权顺序列于图17.3,UART0 具有最高优先权,而CNVSTR 具有最低优先权。当交叉开关配置寄存器XBR0、XBR1 和XBR2 中外设的对应使能位被设置为逻辑1时,交叉开关将端口引脚分配给外设,如图17.7、图17.8 和图17.9 所示。例如,如果UART0EN位(XBR0.2)被设置为逻辑1,则TX0 和RX0 引脚将分别被分配到P0.0 和P0.1。因为UART0有最高优先权,所以当UART0EN 位被设置为逻辑1时其引脚将总是被分配到P0.0 和P0.1。如果一个数字外设的使能位未被设置为逻辑1,则其端口将不能通过器件的端口引脚被访问。注意:当选择了串行通信外设(即SMBus、SPI 或UART)时,交叉开关将为所有相关功能分配引脚。例如,不能为UART0 功能只分配TX0 引脚而不分配RX0 引脚。被使能的外设的每种组合导致唯一的器件引脚分配。端口0-3 中所有未被交叉开关分配的引脚都可以作为通用I/O(GPI/O)引脚,通过读或写相应的端口数据寄存器访问,这是一组既可以按位寻址也可以按字节寻址的SFR。被交叉开关分配的那些端口引脚的输出状态受使用这些引脚的数字外设的控制。向端口数据寄存器(或相应的端口位)写入时对这些引脚的状态没有影响。不管交叉开关是否将引脚分配给外设,读一个端口数据寄存器(或端口位)将总是返回引脚本身的逻辑状态。唯一的例外发生在执行读-修改-写指令(ANL、ORL、XRL、CPL、INC、DEC、DJNZ、JBC、CLR、SET 和位写操作)期间。在读-修改-写指令的读周期,所读的值是端口数据寄存器的内容,而不是端口引脚本身的状态。因为交叉开关寄存器影响器件外设的引脚分配,所以它们通常在外设被配置前由系统的初试化代码配置。一旦配置完毕,将不再对其重新编程。交叉开关寄存器被正确配置后,通过将XBARE(XBR2.6)设置为逻辑1来使能交叉开关。在XBARE 被设置为逻辑1之前,端口0-3 的输出驱动器应被明确禁止,以防止对交叉开关寄存器和其它寄存器写入时在端口引脚上产生争用。被交叉开关分配给输入信号(例如RX0)的引脚所对应的输出驱动器应被明确禁止;以保证端口数据寄存器和PnMDOUT 寄存器的值不影响这些引脚的状态。在XBARE(XBR2.6)被设置为逻辑1之前,端口0-3 的输出驱动器保持禁止状态。每个端口引脚的输出方式都可被配置为漏极开路或推挽方式,缺省状态为漏极开路。在推挽方式,向端口数据寄存器中的相应位写逻辑0将使端口引脚被驱动到GND,写逻辑1将使端口引脚被驱动到VDD。在漏极开路方式,向端口数据寄存器中的相应位写逻辑0将使端口引脚被驱动到GND,写逻辑1将使端口引脚处于高阻状态。当系统中不同器件的端口引脚有共享连接,即多个输出连接到同一个物理线时(例如SMBus 连接中的SDA 信号),使用漏极开路方式可以防止不同器件之间的争用。端口0-3 引脚的输出方式由PnMDOUT 寄存器中的对应位决定。例如P3MDOUT.7 为逻辑1时将P3.7 配置为推挽方式;P3MDOUT.7为逻辑0时将P3.7 配置为漏极开路方式。所有端口引脚的缺省方式均为漏极开路。不管交叉开关是否将端口引脚分配给某个数字外设,端口引脚的输出方式都受PnMDOUT寄存器控制。例外情况是:连接到SDA、SCL、RX0(如果UART0 工作于方式0)、RX1(如果UART1 工作于方式0)的端口引脚总是被配置为漏极开路输出,而与PnMDOUT 寄存器中的对应位的设置值无关。通过设置输出方式为“漏极开路”并向端口数据寄存器中的相应位写1将端口引脚配置为数字输入。例如,设置P3MDOUT.7 为逻辑0并设置P3.7 为逻辑1即可将P3.7 配置为数字输入。如果一个端口引脚被交叉开关分配给某个数字外设,并且该引脚的功能为输入(例如UART0 的接收引脚RX0),则该引脚的输出驱动器被自动禁止。除了外部中断/INT0和/INT1(其引脚由交叉开关分配)之外,P3.6和P3.7可被配置为边沿触发的中断源,用IE6CF(P3IF.2)和IE7CF(P3IF.3)位可以将这两个中断源配置为下降沿或上升沿触发。当检测到P3.6或P3.7有下降沿或上升沿发生时,P3IF寄存器(见图4.36)中对应的外部中断标志(IE6或IE7)将被置1。如果对应的中断被允许,将会产生一个中断,CPU将转向对应的中断向量地址。每个端口引脚都有一个内部弱上拉部件,在引脚与VDD 之间提供阻性连接(约100 k),在缺省情况下该上拉器件被使能。弱上拉部件可以被总体禁止,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论