本帖最后由 a437916817 于 2013-4-19 22:08 编辑
程序包单片机发送0000—FFFF到PC机,用Adobe 软件录音保存为WAVE格式文件,发现数据不连续,请问是哪里出问题了?
程序如下:
/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2009 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
#include <stdio.h>
#include "DrvGPIO.h"
#include "DrvSYS.h"
#include "DrvUART.h"
#include "DrvUSB.h"
//#define CONFIG0_SETTING 0XFFFFFFFE
//#define CONFIG1_SETTING 0X0001F000
//#define LDROM_BASE 0X00100000
//#define CONFIG_BASE 0X00300000
//#define PAGE_BASE 512
extern uint32_t loaderImageBase;
extern uint32_t loaderImageLimit;
extern int32_t UACHID_MainProcess(void);
void Delay(uint32_t delayCnt)
{
while(delayCnt--)
{
__NOP();
__NOP();
}
}
/*---------------------------------------------------------------------------------------------------------*/
/* Main function */
/*---------------------------------------------------------------------------------------------------------*/
int32_t main (void)
{
STR_UART_T sParam;
/* Unlock the locked registers */
UNLOCKREG();
/* Enable 12M OSC */
DrvSYS_SetOscCtrl(E_SYS_XTL12M, 1);
//Enable 22M OSC
//DrvSYS_SetOscCtrl(E_SYS_OSC22M, 1);
/* Enable ISP function */
// DrvFMC_EnableISP();
/* Enable PLL */
DrvSYS_SetPLLMode(0);
Delay(1000);
DrvSYS_SelectHCLKSource(2);
Delay(100);
SystemCoreClockUpdate();
/*-----------------初始化并使能UART和ISP---------------------*/
/* Set UART Pin */
SYS->GPBMFP.UART0_RX = 1;
SYS->GPBMFP.UART0_TX = 1;
/* UART Setting */
sParam.u32BaudRate = 9600;
sParam.u8cDataBits = DRVUART_DATABITS_8;
sParam.u8cStopBits = DRVUART_STOPBITS_1;
sParam.u8cParity = DRVUART_PARITY_NONE;
sParam.u8cRxTriggerLevel= DRVUART_FIFO_1BYTES;
/* Select UART Clock Source From 12Mhz*/
DrvSYS_SelectIPClockSource(E_SYS_UART_CLKSRC,0);
/* Set UART Configuration */
DrvUART_Open(UART_PORT0,&sParam);
printf("\n\n");
printf("\n\n");
printf("+--done!--+");
UACHID_MainProcess();
}
|