语音程序

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

// USCI_A0 TX buffer ready?
// USCI_A0 TX buffer ready? // USCI_A0 TX buffer ready?
void UART_Set(void) {
P4SEL |= BIT4+BIT5; UCA0CTL1 |= UCSWRST;
// P4.4,5 = USCI_A0 TXD/RXD // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2;
// SMCLK
UCA0BR0 = 6;
// 1MHz 9600 (see User's Guide)
UCA0BR1 = 0;
// 1MHz 9600
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCB
#include <msp430f5529.h> #include "string.h" #define uchar unsigned char #define uint unsigned int void Data_send(int length,char* text); uchar headofFrame[5]; //数据包头 char text[]={0xd3,0xef,0xd2,0xf4,0xcc,0xec,0xcf,0xc2}; int length=8;
//语音数据
void Data_send(int length,char* text) {
unsigned char ecc = 0; int i; headofFrame[0] = 0xfd;
headofFrame[1] = 0x00; headofFrame[2] = length + 3; headofFrame[3] = 0x01; headofFrame[4] = 0x00; for(i=0;i<5;i++) {
RFx=0,
// over sampling
UCA0CTL1 &= ~UCSWRST;
// **Initialize USCI state mac
hine**
}Leabharlann Baidu
void main(void) {
WDTCTL = WDTPW + WDTHOLD; UART_Set(); Data_send(length,text); while (!(UCA0IFG&UCTXIFG)); while(1)
ecc = ecc^(headofFrame[i]); while (!(UCA0IFG&UCTXIFG)); UCA0TXBUF = headofFrame[i]; } for(i=0;i<length;i++) { ecc = ecc^(text[i]); while (!(UCA0IFG&UCTXIFG)); UCA0TXBUF = text[i]; } while (!(UCA0IFG&UCTXIFG)); UCA0TXBUF = ecc; }
{
// USCI_A0 TX buffer ready?
} }
相关文档
最新文档