测试程序过程中,自己编写的驱动P1.4、P1.5点亮led程序软件仿真无误,ISP下载后,退出ISP,重新上电,没有反应。程序如下。不知哪里设置有问题,请求帮助。程序如下:
/* my first lpc1114 */
# include "lpc11xx.h"
void delay(unsigned char d)
{
unsigned char i;
unsigned int j;
for(i=0;i
for(j=0;j<2500;j++);
}
void SysCLK_config(void)
{
unsigned int i;
LPC_SYSCON->PDRUNCFG &= ~(1<<5);
LPC_SYSCON->SYSOSCCTRL = 0x00000000;
for (i = 0; i < 200; i++) __nop();
LPC_SYSCON->SYSPLLCLKSEL = 0x00000001;
LPC_SYSCON->SYSPLLCLKUEN = 0x01;
LPC_SYSCON->SYSPLLCLKUEN = 0x00;
LPC_SYSCON->SYSPLLCLKUEN = 0x01;
while (!(LPC_SYSCON->SYSPLLCLKUEN & 0x01));
LPC_SYSCON->SYSPLLCTRL = 0x00000023;
LPC_SYSCON->PDRUNCFG &= ~(1 << 7);
while(! (LPC_SYSCON->SYSPLLSTAT & 0X01));
LPC_SYSCON->MAINCLKSEL = 0x00000003;
LPC_SYSCON->MAINCLKUEN = 0x01;
LPC_SYSCON->MAINCLKUEN = 0x00;
LPC_SYSCON->MAINCLKUEN = 0x01;
while (!(LPC_SYSCON->MAINCLKUEN & 0x01));
LPC_SYSCON->SYSAHBCLKDIV = 0x01;
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6);
LPC_IOCON->PIO1_4=~0x7;
LPC_IOCON->PIO1_5=~0x7;
}
main()
{
unsigned int d=5000;
void SysCLK_config(void);
LPC_SYSCON->SYSAHBCLKCTRL|=(1<<6);
LPC_GPIO1->DIR|=(1<<4);
LPC_GPIO1->DIR|=(1<<5);
while(1)
{
LPC_GPIO1->DATA&=~(1<<4);
LPC_GPIO1->DATA&=~(1<<5);
delay(d);
LPC_GPIO1->DATA|=(1<<4);
LPC_GPIO1->DATA|=(1<<5);
delay(d);
}
}
|