本帖最后由 szt1993 于 2023-2-28 14:26 编辑
#申请原创#@21小跑堂
MSP430系列MCU下载驱动库的话肯定涉及驱动库的使用,下面咱们一起以MSP430 DriverLib for MSP430FR2xx_4xx Devices的驱动库为例给大家详细说明一下TI IDE CCS如何查阅相关的文档!
打开ccs后点击View界面,弹出相关试图菜单,其中Resource Exerplorer和Resource Exerplorer Offline就是搜索资源窗口,第一个是在线资源第二个是离线资源!
在在线资源下面的MSP430Ware (3.80.14.01)选择Libraries就会出现关于MSP430的相关文件
在Libraries库文件下选择Driver Library驱动库文件,驱动文件分MCU进行存放,选择需要的MCU进行查阅
驱动库文件下游各种驱动示例,以GPIO为例讲解一下:
点击GPIO会弹出相关的GPIO的相关案例程序,选择需要的查看API函数以及使用过程,里面讲解的很详细,里面的驱动库也比较齐全,唯一的缺点是相关讲解说明是英文的。
- /* --COPYRIGHT--,BSD
- * Copyright (c) 2017, Texas Instruments Incorporated
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * --/COPYRIGHT--*/
- //******************************************************************************
- // Write a Word to Port A (Port1+Port2)
- //
- // Writes a Word(FFFFh) to Port A and stays in LPM4
- // ACLK = 32.768kHz, MCLK = SMCLK = default DCO
- //
- // Tested On: MSP430FR4133
- // -----------------
- // /|\| |
- // | | |
- // --|RST PA.x|-->HI
- // | |
- // | |
- //
- //
- // This example uses the following peripherals and I/O signals. You must
- // review these and change as needed for your own board:
- // - GPIO Port peripheral
- //
- // This example uses the following interrupt handlers. To use this example
- // in your own application you must add these interrupt handlers to your
- // vector table.
- // - None.
- //******************************************************************************
- #include "driverlib.h"
- void main (void)
- {
- //Stop WDT
- WDT_A_hold(WDT_A_BASE);
- //PA.x output
- GPIO_setAsOutputPin(
- GPIO_PORT_PA,
- GPIO_PIN0 + GPIO_PIN1 + GPIO_PIN2 + GPIO_PIN3 +
- GPIO_PIN4 + GPIO_PIN5 + GPIO_PIN6 + GPIO_PIN7 +
- GPIO_PIN8 + GPIO_PIN9 + GPIO_PIN10 + GPIO_PIN11 +
- GPIO_PIN12 + GPIO_PIN13 + GPIO_PIN14 + GPIO_PIN15
- );
- //Set all PA pins HI
- GPIO_setOutputHighOnPin(
- GPIO_PORT_PA,
- GPIO_PIN0 + GPIO_PIN1 + GPIO_PIN2 + GPIO_PIN3 +
- GPIO_PIN4 + GPIO_PIN5 + GPIO_PIN6 + GPIO_PIN7 +
- GPIO_PIN8 + GPIO_PIN9 + GPIO_PIN10 + GPIO_PIN11 +
- GPIO_PIN12 + GPIO_PIN13 + GPIO_PIN14 + GPIO_PIN15
- );
- PMM_unlockLPM5();
- //Enter LPM4 w/interrupts enabled
- __bis_SR_register(LPM4_bits + GIE);
- //For debugger
- __no_operation();
- }
整体的一个TI CCS 软件相关资料的查阅基本就是在线查找即可,非常方便快捷,对于新手来说也非常友好,只不过需要深入学习一下!
最后咱们说一下在线资源和离线资源的对比情况。
在线资源列表如下图:
离线资源列表如下图:
在线资源与离线资源对比总结如下:
1、离线资源就是下载的MSP430 Ware资源包含库、设备等
2、在线资源不仅包含MSP430的资源还包含其他的MCU资源、Hardware kits and boards等资源,种类更齐全
3、在线资源实时更新,所有库文件状态会有所变化
个人建议使用在线资源进行相关文档的查阅学习!
|