昨天拿到TI的MSP432 launchpad实验板,随便搞了一个例程,无法使用,后来在TI官网下载一个有关MSP的
软件还是无法使用,再后来,更新了我的keil5 for ARM,可以运行TI的例程。
再再后来,我重新安装了CCS6.1软件,只选择了MSP430,勾选MSP432选项,这个默认是非选中的。
涛声依旧。
/*
* -------------------------------------------
* MSP432 DriverLib - v2_20_00_08
* -------------------------------------------
*
* --COPYRIGHT--,BSD,BSD
* Copyright (c) 2014, 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--*/
/*******************************************************************************
* MSP432 GPIO - Input Interrupt
*
* Description: This example demonstrates a very simple use case of the
* DriverLib GPIO APIs. P1.1 (which has a switch connected to it) is configured
* as an input with interrupts enabled and P1.0 (which has an LED connected)
* is configured as an output. When the switch is pressed, the LED output
* is toggled.
*
* MSP432P401
* ------------------
* /|\| |
* | | |
* --|RST P1.0 |---> P1.0 LED
* | |
* | P1.1 |<--Toggle Switch
* | |
* | |
*
* Author: Timothy Logan
******************************************************************************/
/* DriverLib Includes */
#include "driverlib.h"
/* Standard Includes */
#include
#include
int main(void)
{
volatile uint32_t ii;
/* Halting the Watchdog */
MAP_WDT_A_holdTimer();
/* Configuring P1.0 as output and P1.1 (switch) as input */
MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
/* Configuring P1.1 as an input and enabling interrupts */
MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);
MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);
MAP_Interrupt_enableInterrupt(INT_PORT1);
/* Enabling SRAM Bank Retention */
MAP_SysCtl_enableSRAMBankRetention(SYSCTL_SRAM_BANK1);
/* Enabling MASTER interrupts */
MAP_Interrupt_enableMaster();
/* Going to LPM3 */
while (1)
{
MAP_PCM_gotoLPM3();
}
}
/* GPIO ISR */
void gpio_isr(void)
{
uint32_t status;
status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);
MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);
/* Toggling the output on the LED */
if(status & GPIO_PIN1)
{
MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
}
}