第三章MSP430基本外设解读.ppt

  1. 1、本文档共119页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
P1 端口输入输出电路 input/output schematic P1SEL.x=0,不考虑中断功能 P1SEL.x P1DIR.x P1OUT.x P1IN.x P1.x x = 0 ~ 7 P1SEL.x=0 , P1DIR.x=1 General-purpose digital I/O——Output P1SEL.x=0 , P1DIR.x=0 General-purpose digital I/O——Input Direction Registers PxDIR(输入/输出方向寄存器) Each bit in each PxDIR register selects the direction of the corresponding I/O pin, regardless of the selected function for the pin. PxDIR bits for I/O pins that are selected for other module functions must be set as required by the other function. Bit = 0: The port pin is switched to input direction Bit = 1: The port pin is switched to output direction Input Register PxIN(输入寄存器) Each bit in each PxIN register reflects the value of the input signal at the corresponding I/O pin when the pin is configured as I/O function. Bit = 0: The input is low Bit = 1: The input is high Output Registers PxOUT(输出寄存器) Each bit in each PxOUT register is the value to be output on the corresponding I/O pin when the pin is configured as I/O function and output direction. Bit = 0: The output is low Bit = 1: The output is high Function Select Registers PxSEL(功能选择寄存器) Port pins are often multiplexed with other peripheral module functions. See the device-specific data sheet to determine pin functions. Each PxSEL bit is used to select the pin function ? I/O port or peripheral module function. Bit = 0: I/O Function is selected for the pin Bit = 1: Peripheral module function is selected for the pin PxREN(上拉或下拉电阻使能寄存器) Bit = 0:禁用上拉/下拉电阻 Bit = 1:使能上拉/下拉电阻 PxDS(输出驱动强度寄存器) Bit = 0:低驱动强度 Bit = 1:高驱动强度 例题:流水灯实验 程序 #include msp430x24x.h unsigned int i; void main() { WDTCTL=WDTHOLD+WDTPW; P1DIR=0xff; while(1) { P1OUT=0x01; for(i=50000;i0;i--); P1OUT=0x02; for(i=50000;i0;i--); P1OUT=0x04; for(i=50000;i0;i--); P1OUT=0x08; for(i=50000;i0;i--); P1OUT=0x10; for(i=50000;i0;i--); P1OUT=0x20; for(i=50000;i0;i--); P1OUT=0x40; for(i=50000;i0;i--); P1OUT=0x80; for(i=50000;i0;i--); } } 3.4 定时器 3.4.2 定时器A ◆ 定时器A的特性 ◆ 定时器A的结构

您可能关注的文档

文档评论(0)

shuwkb + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档