[求助] 请大家看看程序有问题吗

85639973   2012-9-20 15:13 楼主
#include
#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)

帮帮

编译没问题,程序功能实现不了
点赞  2012-9-20 15:13
实现不了功能具体是指什么?
把 GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3,~GPIO_PIN_3);

变成
GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_3,0);试试
点赞  2012-9-20 15:48

问题

希望大家帮帮忙
  • 问题.jpg

    未命名.jpg (2012-9-21 10:19 上传)

    20.32 KB, 下载次数: 0

    问题

点赞  2012-9-21 10:19

总是这个问题

Fri Sep 21, 2012 15:27:26: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.4 Kickstart_2\arm\config\flashloader\TexasInstruments\FlashLM3Sxxx.mac
不知道问题怎么解决
点赞  2012-9-21 15:23

问题

Fri Sep 21, 2012 15:27:26: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.4 Kickstart_2\arm\config\flashloader\TexasInstruments\FlashLM3Sxxx.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 Systems\Embedded Workbench 6.4 Kickstart_2\arm\config\flashloader\TexasInstruments\FlashLM3SxxxRAM32K.out
Fri Sep 21, 2012 15:27:26: Target reset
Fri Sep 21, 2012 15:27:27: Downloaded C:\Users\Administrator.XZ51YFJMITBHWEU\Desktop\lx\Debug\Exe\lx.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:\Users\Administrator.XZ51YFJMITBHWEU\Desktop\lx\Debug\Exe\lx.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
点赞  2012-9-21 15:24
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复