STR912如何设置使管脚功能.doc_第1页
STR912如何设置使管脚功能.doc_第2页
STR912如何设置使管脚功能.doc_第3页
STR912如何设置使管脚功能.doc_第4页
全文预览已结束

下载本文档

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

文档简介

STR912如何设置使管脚功能?2008-01-23 11:24STR912 GPIO 相关的寄存器GPIO_DIR GPIO Data Direction Register These bits are set and cleared by software to configure the correspondingGPIO pin to be an input or an output.All bits are cleared by a reset.Therefore, the GPIO pins are input by default.0: Input1: OutputGPIO_SEL GPIO Mode Control Register These bits are set an cleared by software.All bits are cleared by a reset.Therefore, the GPIO pins are GPIO mode by default.0: GPIO mode (for general purpose I/O)1: ReservedNote: This bit must be 0 when GPIO is used.GPIO_DATA GPIO Data RegisterValues written in the GPIO_DATA register are transferred onto theGPIO pins if the respectivepins have been configured as outputs through the GPIO_DIR registerand Alternate Function 1 is configured in the SCU_GPIOOUT register.看起来如果要把数据发送到端口引脚:1. GPIO_DIR :1 : GPIO as Output2. SCU_GPIOOUT : 01 : Alternate Function 1In order to write to GPIO_DATA, the corresponding bits in the mask,resulting from the from bits 9:2 of the address offset, must beHIGH. Otherwise the bit values remain unchanged by the write.Similarly, the values read from this register are determined for eachbit, by the mask bit derived from bits 9:2 of the address offset used to access the data register.Bits that are 1 in the address mask cause the corresponding bits inGPIO_DATA to be read, and bits that are 0 in the address maskcause the corresponding bits in GPIO_DATA to be read as 0,regardless of their value.A read from GPIO_DATA returns the last bit value written if therespective pins are configured as output, or it returns the value onthe corresponding input pin when these are configured as inputs. Allbits are cleared by a reset.看起来, 读取GPIO_DATA时:1. 读取到输出锁存器的值 : GPIO 作为输出2. 读取GPIO的引脚状态 : GPIO 作为输人System control unit GPIO registersGPIO Pins on P0 thru P7 have multiple input and output alternate functions.You select these using the System Control Unit (SCU)registers.GPIO output register (SCU_GPIOOUTn)Reset value: 0000 0000 0000 0000Pn.7:0OUT1:0: GPIO Port Output Control bits00: Input mode - Default Mode01: Alternate Output 1 (general purpose output)10: Alternate Output 211: Alternate Output 3SCU registers are also used to select open collector or Push-Pull operationGPIO type register (SCU_GPIOTYPEm)TYPE7:0: GPIO output type registerThese bits are set and cleared by software to configure thecorresponding GPIO pin output type.All bits are cleared by a reset, so the GPIO pins are push-pull by default.0: Push-pull1: Open collectorand to configure Port 4 pins for use as analog inputs.GPIO analog mode register (SCU_GPIOANA)P47:0A: GPIO Port 4 Analog Control bitsThese bits are set and cleared by software to configure the correspondingGPIO port 4 pin in analog mode. When you use analog mode, clear thecorresponding bits in the SCU_GPIOINn and SCU_GPIOUTn registers.0: Analog mode off1: Analog mode onGPIO Pins on P8 thru P9 are only multiplexed with EMI and have no SCU output or input control registers.GPIO external memory interface register (SCU_EMI)GPIOEMI: GPIO EMI selectionThis bit is set and cleared by software to configure Port 8 and 9 to the EMIblock. It is cleared by a reset. Therefore, the external memory bus isdisabled by default.0: Port 8 and 9 used for general purpose I/O1: Port 8 and 9 connected to EMI blockAll ports have SCU_GPIOTYPE registers for selectingOpen Collector or Push/Pull configuration.GPIO type register (SCU_GPIOTYPEm)TYPE7:0: GPIO output type registerThese bits are set and cleared by software to configure thecorresponding GPIO pin output type.All bits are cleared by a reset, so the GPIO pins are push-pull by default.0: Push-pull1: Open collectorGPIO input register (SCU_GPIOINn)Pn.7:0IN: GPIO Port Input Control bits0: On-

温馨提示

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

评论

0/150

提交评论