LPC串口不能通讯了。。怎么解决。。。
ISP开关已经关掉。。(之前通讯多次忘了关掉)下面是少写的程序
#include "nxplpc11xx.h"
#include "w25x16.h"
#include "ili9325.h"
#include "adc.h"
#include "uart.h"
#include "wdg.h"
int main()
{
uint32 num,res,xposition=130;
uint8 s,temp,byte;
uint8 buf;
uint8* bud;
SysCLK_config(); // 时钟配置
LCD_Init(); // 初始化液晶显示器
LCD_Clear(WHITE); // 整屏显示白色
W25X16_Init(); // 初始化字库芯片W25X16
/* WDT_Enable(); // 看门狗初始化,1秒钟之内喂狗
WDTFeed();// 喂狗 */
ADC_Init(); // 初始化ADC口
UART_init(115200); // 串口,并设置波特率
POINT_COLOR = BLACK; // 定义笔的颜色为黑色
BACK_COLOR = YELLOW; // 定义笔的背景色为黄色
LCD_ShowString(5,12,"“瑞生嵌入式”温度测试演示");
LCD_ShowString(32,200,"开发板上采用MF58高精度热敏电阻,");
POINT_COLOR = DARKBLUE; // 定义笔的颜色为深蓝色
BACK_COLOR = WHITE;// 定义笔的背景色为白色
LCD_ShowString(5,40,"此时P1.11引脚上的电压值为:");
LCD_ShowString(5,80,"此时热敏电阻的电阻值为:");
LCD_ShowString(5,120,"此时您所在环境的温度值:");
LCD_ShowString(5,160,"此时您所设定的温度值:");
POINT_COLOR = BLUE;
LCD_ShowString(162,60,"毫伏");
LCD_ShowString(162,100,"欧姆");
LCD_ShowString(162,140,"摄氏度");
LCD_ShowString(162,180,"摄氏度");
while(1)
{
num = ADC_Read(); // 读取AD7口电压值
res = ADC_To_Res(num); // 根据电压值得出热敏电阻的阻值
temp = Res_To_Temp(res);// 根据热敏电阻的阻值得出此时的温度值
s = Fetch_sign(res); // 获取温度是在零上还是零下
*bud=temp;
byte=UART_recive(); // 等待接收数据
buf=byte; // 把接收到的数据给了buf
byte = UART_recive();// 再接收一个字(汉字是有两个字节组成的)
buf = byte; // 把第二个字节送给buf
xposition = xposition+0;
/* delay_ms(200);*/
UART_send(bud,1);
POINT_COLOR = RED; // 定义笔的颜色为红色
LCD_ShowNum(100,60,num,4);
LCD_ShowNum(92,100,res,6);
LCD_ShowNum(130,140,temp,3);
LCD_ShowString(xposition, 180, buf); // 在TFT上显示接收到的数据
POINT_COLOR = DARKBLUE; // 定义笔的颜色为深蓝色
if(s==0)LCD_ShowString(100,140,"零下");
else LCD_ShowString(100,140,"零上");
delay_ms(500);
delay_ms(500); // 一秒钟测量一次(注意:此延时函数的参数最大值:699)
}
}
开发板是lpc1114
页:
[1]