下面是主函数的代码,别的地方都使用了战舰的附带例程代码,只有把Keil设置成RAM下载模式了
这是设置RAM下载修改的NVIC地址偏移
//////////////////////////////////////////////////////////////////////////
void NVIC_Configuration(void)
{
#ifdef VECT_TAB_RAM
// Set the Vector Table base location at 0x20000000
NVIC_SetVectorTable(NVIC_VectTab_RAM,0x0);
#else
// Set the Vector Table base location at 0x80000000
NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x0);
#endif
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
}
////////////////////////////////////////////////////////////////
这是主函数main.c :
#include "sys.h"
#include "delay.h"
#include "led.h"
#include "lcd.h"
#include "usart.h"
#define VECT_TAB_RAM
int main()
{
u8 i = 0;
NVIC_Configuration(); //?è??NVIC????·?×é2:2??????????????2???ì????????
delay_init();
LED_Init();
LCD_Init();
uart_init(9600);
LCD_Clear(BLUE);
BACK_COLOR = BLUE;
POINT_COLOR = BLACK;
LCD_ShowString(20,20,200,16,16,"usart success");
while(1)
{
if(USART_RX_STA&0x8000)
{
i++;
LCD_ShowNum(20,40,i,3,16);
USART_RX_STA = 0;
}
}
}
经测试,一样的程序,下载到flash中没问题 ,下载到RAM中就无反应了 ,收不到电脑端串口发过来的信息,但是给电脑发送是可以的
求助各位了,有没有遇到过类似情况的
|