请大家看看程序有问题吗

2019-03-24 13:25发布

#include <LM3S9B96.h>
#include "hw_memmap.h"
#include "hw_types.h"
#include "gpio.h"
#include "sysctl.h"
int i;
int main(void)
{

SysCtlClockSet(SYSCTL_SYSDIV_1|SYSCTL_USE_OSC|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);//16MHZ,主频,不分频
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);//使能PF口
GPIODirModeSet(GPIO_PORTF_BASE,GPIO_PIN_3,GPIO_DIR_MODE_OUT); //PF3为输出
GPIOPadConfigSet(GPIO_PORTF_BASE,GPIO_PIN_3,GPIO_STRENGTH_4MA,GPIO_PIN_TYPE_STD);//端口配置/驱动电流4MA/推挽管脚
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);  //使能PJ口
GPIODirModeSet(GPIO_PORTJ_BASE,GPIO_PIN_7,GPIO_DIR_MODE_IN); //PJ设为输入
GPIOPadConfigSet(GPIO_PORTJ_BASE,GPIO_PIN_7,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD);//端口配置
while(1)
{
  if(GPIOPinRead(GPIO_PORTJ_BASE,GPIO_PIN_7)==0x00) //判断PJ_7是否为0
  {
   GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3,GPIO_PIN_3);//点亮LED
  }
  else                //否则熄灭LED
  {
   GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3,~GPIO_PIN_3);
  }
  for(i=0;i<0xffff;i++);
}
} 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
5条回答
85639973
1楼-- · 2019-03-24 21:35
 精彩回答 2  元偷偷看……
119083515
2楼-- · 2019-03-24 23:07
< :TI_MSP430_内容页_SA7 --> 实现不了功能具体是指什么?
把 GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3,~GPIO_PIN_3);
变成 GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3,0);试试
85639973
3楼-- · 2019-03-25 02:53
希望大家帮帮忙
85639973
4楼-- · 2019-03-25 05:03
 精彩回答 2  元偷偷看……
85639973
5楼-- · 2019-03-25 08:37
Fri Sep 21, 2012 15:27:26: Loaded macro file: C:Program Files (x86)IAR SystemsEmbedded Workbench 6.4 Kickstart_2armconfigflashloaderTexasInstrumentsFlashLM3Sxxx.mac
Fri Sep 21, 2012 15:27:26: JTAG Speed is set to: 500 kHz
Fri Sep 21, 2012 15:27:26: JTAG IDCODE      = 0x4BA00477
Fri Sep 21, 2012 15:27:26: AHB-AP ID        = 0x24770011
Fri Sep 21, 2012 15:27:26: AHB-AP ROM       = 0xE00FF003
Fri Sep 21, 2012 15:27:26: ROM Component ID = 0xB105100D
Fri Sep 21, 2012 15:27:26: Device ID        = 0x0000006F (Unknown)
Fri Sep 21, 2012 15:27:26: Software reset was performed
Fri Sep 21, 2012 15:27:26: Initial reset was performed
Fri Sep 21, 2012 15:27:26: Turning off watchdog
Fri Sep 21, 2012 15:27:26: 512 bytes downloaded and verified (5.32 Kbytes/sec)
Fri Sep 21, 2012 15:27:26: Loaded debugee: C:Program Files (x86)IAR SystemsEmbedded Workbench 6.4 Kickstart_2armconfigflashloaderTexasInstrumentsFlashLM3SxxxRAM32K.out
Fri Sep 21, 2012 15:27:26: Target reset
Fri Sep 21, 2012 15:27:27: Downloaded C:UsersAdministrator.XZ51YFJMITBHWEUDesktoplxDebugExelx.out to flash memory.
Fri Sep 21, 2012 15:27:27: Software reset was performed
Fri Sep 21, 2012 15:27:27: 488 bytes downloaded into FLASH and verified (0.46 Kbytes/sec)
Fri Sep 21, 2012 15:27:27: Loaded debugee: C:UsersAdministrator.XZ51YFJMITBHWEUDesktoplxDebugExelx.out
Fri Sep 21, 2012 15:27:28: Software reset was performed
Fri Sep 21, 2012 15:27:28: Target reset
Fri Sep 21, 2012 15:27:45: Software reset was performed
Fri Sep 21, 2012 15:27:45: Target reset
Fri Sep 21, 2012 15:27:54: Software reset was performed
Fri Sep 21, 2012 15:27:54: Target reset

一周热门 更多>

相关问题

    相关文章