这个函数传递报错:
void USART_SetBaudrate(USART_TypeDef* USARTx,u32 Sysclk,u32 USART_BDrate)
{
u32 Temp_PDIVBR = 0;
u32 Temp_DIVTR = 0;
u32 Temp[2];
Temp_PDIVBR = (u32)(Sysclk/(16*USART_BDrate));
USARTx->PDIVBR = (u16)(Temp_PDIVBR - 1);
Temp_DIVTR = ((Sysclk*10000)/(16*USART_BDrate))%10000;
Temp_DIVTR = 16-(Temp_DIVTR*16)/10000;
USARTx->PDIVBR = (u16)(Temp_DIVTR - 1);
调用时:USART_SetBaudrate(USART1,SystemClock,USART_Baud);设置波特
USART1的宏定义:#define USART1 ((USART_TypeDef *) USART1_BASE)
USART1_BASE的定义:#define USART1_BASE (USART_BASE+0x100) //反正是个地址的数值了
USART_TypeDef的定义:
typedef struct
{
__IO uint16_t LCONR; //USART Line Control Register
uint16_t RESERVED0;
__IO uint16_t PDIVBR; //USART Pre-Divide Baudrate register
uint16_t RESERVED1;
__IO uint16_t DIVTR; //USart 16-Divide Threshold register
uint16_t RESERVED2;
__IO uint16_t BUFFER; //USart transmit& receive buffer
uint16_t RESERVED3;
__I uint16_t LSTTR; //USart line state reister
uint16_t RESERVED4;
__I uint16_t FSTTR; //USart fifo state register
uint16_t RESERVED5;
__I uint16_t ESTTR; //USart erro state reigster
uint16_t RESERVED6;
__IO uint16_t MTADR; //USart multi-drop mode match address register
uint16_t RESERVED7;
__IO uint16_t FCONR; //USart fifo control register
uint16_t RESERVED8;
__IO uint16_t SOFTRST;//USart soft reset virtual register
uint16_t RESERVED9;
} USART_TypeDef;
Mips结构,Gcc编译
报错结果:
QQ截图20120809172059.jpg (40.21 KB, 下载次数: 12)
下载附件
2012-8-9 17:22 上传
求大神指点一下,临帖涕零啊!!!
stray 'xxx' in program表示不知名的字符或者编码格式错误
一周热门 更多>