8962的系统时钟设置问题(不用库,直接操作寄存器)
[复制链接]
代码: #include <lm3s8962.h> void Delay(void) { unsigned long Tmp = 0xFFFFFF; while(--Tmp); } int main(void) { unsigned long RCC; unsigned long RCC2; RCC = SYSCTL_RCC_R; RCC2 = SYSCTL_RCC2_R; RCC |= SYSCTL_RCC_BYPASS; RCC &= ~SYSCTL_RCC_USESYSDIV; RCC2 |= SYSCTL_RCC2_BYPASS2; SYSCTL_RCC_R = RCC; SYSCTL_RCC2_R = RCC2; RCC &= ~SYSCTL_RCC_MOSCDIS; RCC |= SYSCTL_RCC_IOSCDIS; SYSCTL_RCC_R = RCC; Delay(); RCC |= SYSCTL_RCC_XTAL_8MHZ; RCC |= SYSCTL_RCC_OSCSRC_MAIN; RCC &= ~SYSCTL_RCC_PWRDN; SYSCTL_RCC_R = RCC; Delay(); RCC &= ~SYSCTL_RCC_SYSDIV_16; RCC |= SYSCTL_RCC_SYSDIV_4; RCC |= SYSCTL_RCC_USESYSDIV; SYSCTL_RCC_R = RCC; //--------------运行了这句KEIL出错 while((SYSCTL_RIS_R & SYSCTL_RIS_PLLLRIS) == 0); RCC &= ~SYSCTL_RCC_BYPASS; RCC = SYSCTL_RCC_R; SYSCTL_RCC_R = RCC; while(1); } 首先问题是这样: 无论用KEIL3或者KEIL4,运行完SYSCTL_RCC_R = RCC; 就会马上出错 另外,将Delay延长点也一样出错的。 板是8962 EV KIT,用8M主晶振,想倍频到50M