[img]file:///C:/Users/Administrator.USER-20151215XG/AppData/Roaming/Tencent/Users/731434691/QQ/WinTemp/RichOle/T5_XQL0ZB[
J3R@F8_J_YS7S.png[/img] file:///C:/Users/Administrator.USER-20151215XG/AppData/Roaming/Tencent/Users/731434691/QQ/WinTemp/RichOle/I_L]58]0U)5%25)VUCNWZ6%60JM.png [img]file:///C:/Users/Administrator.USER-20151215XG/AppData/Roaming/Tencent/Users/731434691/QQ/WinTemp/RichOle/@NMNTRGMQBJMM17%7BVKQY[KG.png[/img]
怎么显示数据一定要勾上16进制显示,不勾出现乱码,
char A[]={1,0,0,1,},B[]={6,9,5,4},C[16]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int R[10],L[10];
void matrix()
{
int j,k,x,d;
for(d=0;d<4;d++)C[d]=0;
for(j=0;j<2;j++){
for(k=0;k<2;k++){
for(x=0;x<2;x++){(char*)C[k*2+j]+=A[k*2+x]*B[x*2+j];}
}
}
}
if(USART_RX_STA&0x8000)
{
len=USART_RX_STA&0x3fff;//得到此次接收到的数据长度//mage(USART_RX_BUF,R,L,0,len-1,(len-1)/2);//MERGE(USART_RX_BUF,0,len-1);
matrix();
for(t=0;t<4;t++)
{
USART_SendData(USART1, C[t]);//向串口1发送数据
while(USART_GetFlagStatus(USART1,USART_FLAG_TC)!=SET);//等待发送结束
}
USART_RX_STA=0;
}
一周热门 更多>