MSP430FR5994LannchPad开发笔记之三:MSP430的IO复用以及如何去获取IO复用功能

一、 MSP430FR5994 gpio“第二”功能概述(user guide.pdf)

该功能可以通过相关芯片的user guide–>digital I/O–>Digital I/O operation中有相关说明:
端口引脚通常与其他外围模块功能复用。 可以参阅特定MCU的datasheet来确定引脚功能。 每个端口引脚使用两个位来选择引脚功能 - I/O 端口或三种可能的外围模块功能中其中一个(三取一)。 下图显示了如何选择各种模块功能。
每个 PxSEL 位用于选择引脚功能——I/O 端口或外围模块功能。
I/O function selection
00 General purpose I/O 默认值
01 Primary module function driverLib宏定义:GPIO_PRIMARY_MODULE_FUNCTION
10 Secondary module function driverLib宏定义:GPIO_SECONDARY_MODULE_FUNCTION
11 Tertiary module function driverLib宏定义:GPIO_TERNARY_MODULE_FUNCTION

二、MSP430FR5994 gpio框图、引脚功能及外设引脚概述(datasheet.pdf)

在相关mcu对应的datasheet中,在Terminal Configuration and Functions章节分别介绍了不同封装的IO分配** Pin Diagrams**。
Pin Diagrams

各IO属性概述Pin Attributes
Pin Attributes

各片上外设可用引脚Signal Descriptions
Signal Descriptions

各引脚功能框图及引脚第二功能详情Detailed Description–>Input/Output Diagrams

PIN Diagram
PIN Function

三、 牛刀小试

这里测试将MCLK时钟通过pin输出。
在这里插入图片描述
图中可以看到,22脚和68脚都可以输出MCLK。
查22脚为PJ.1,68脚为P5.7
因此查PJ.1P5.7的引脚功能选择
PJ.1功能
P5.7功能

3.1 PJ.1作为MCLK时钟输出

    //Set PJ.1 as Output Low (for setup as ACLK).
    /*
    * Select Port J
    * Set Pin 1 to output Low.
    * 经测试,这个可以不用写。
    */
    GPIO_setOutputLowOnPin(
    	GPIO_PORT_PJ,
    	GPIO_PIN1
    );

    //Set PJ.1 as Primary Module Function Output.
    /*
    * Select Port J
    * Set Pin 1 to output Primary Module Function, (MCLK).
    * 设置PIN的dir和sel。
    */
    GPIO_setAsPeripheralModuleFunctionOutputPin(
    	GPIO_PORT_PJ,
    	GPIO_PIN1,
    	GPIO_PRIMARY_MODULE_FUNCTION
    );

3.2 P5.7作为MCLK时钟输出

    //Set P5.7 as Output Low (for setup as ACLK).
    /*
    * Select Port 5
    * Set Pin 7 to output Low.
    * 经测试,这个可以不用写。
    */
    GPIO_setOutputLowOnPin(
    	GPIO_PORT_P5,
    	GPIO_PIN7
    );

    //Set P5.7 as Ternary Module Function Output.
    /*
    * Select Port 5
    * Set Pin 7 to output Ternary Module Function, (MCLK).
    * 设置PIN的dir和sel。
    */
    GPIO_setAsPeripheralModuleFunctionOutputPin(
    	GPIO_PORT_P5,
    	GPIO_PIN7,
    	GPIO_TERNARY_MODULE_FUNCTION
    );

—(END)—

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值