|
试芯片串口功能的时候,老是不发送,芯片是NUC140,源码如下,搞了两天了毫无头绪,官方给的例子也不行,倒是一个学长写的移植UCOS的串口任务可以
#include<stdio.h>
#include"NUC1xx.h"
#include"DrvSys.h"
#include"DrvGPIO.h"
#include"DrvUART.h"
//#include"NUC122.h"
#include"DrvTimer.h"
void ARMTargetInit(void)
{
STR_UART_T sParam;
UNLOCKREG(); // 解锁系统寄存器
SYSCLK->PWRCON.OSC22M_EN = 1;// 初始化系统时钟
SYSCLK->PWRCON.XTL12M_EN = 1;
SYSCLK->CLKSEL0.HCLK_S = 0;
sParam.u32BaudRate = 115200; //初始化UART
sParam.u8cDataBits = DRVUART_DATABITS_8;
sParam.u8cStopBits = DRVUART_STOPBITS_1;
sParam.u8cParity = DRVUART_PARITY_NONE;
sParam.u8cRxTriggerLevel= DRVUART_FIFO_1BYTES;
DrvSYS_SelectIPClockSource(E_SYS_UART_CLKSRC, 0);
DrvUART_Open(UART_PORT0, &sParam);
DrvGPIO_InitFunction(E_FUNC_UART0);
}
int main (void)
{
uint8_t CharBuffer[5] = {0x68,0x65,0x6c,0x6c,0x6f};
ARMTargetInit();
printf("run task2,the OsfasfSTime is ");
printf("run task2,the OSTime is ");
printf("run task2,thddsfs ");
DrvUART_Write(UART_PORT0,CharBuffer,5) ;
printf("run task2,the OfadfSTime is ");
printf("run task2,the OafdfSTime is ");
} |
阿莫论坛20周年了!感谢大家的支持与爱护!!
曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
|