Dear all i am trying to set up a buffer through Usart and trying to send some data through this buffer .below is my function for the buffer i wanted to ask if my function is correct or not .? ofcourse it is not the whole program.just wanted to know if i have made the function correct. your response will be highly aprreciated void USART_Puts(USART_TypeDef* USARTx,volatile char *s) { while(*s) { while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET); USART_SendData(USARTx,*s); *s++; } } void TxMessage(COM_BYTE *Buffer, COM_UINT16 count) { int i=0; for (i=0;i<count;i++) { USART_Puts(USART3, Buffer); } while(1) { // sprintf(str, "i am USART_3 "); // USART_Puts(USART3,str); UI_16 Test[10]; Test[0]='H'; Test[1]='a'; Test[2]='l'; Test[3]='l'; Test[4]='o'; Test[5]=' '; Test[6]=' '; Test[7]=' '; Test[8]='e'; Test[9]='o'; TxMessage (Test,10); }
No, it isn't correct. If you can't figure out why, read a book on C programming 101. Or test it. Sooner or later you'll figure out why. Hint: It may seem to work at some times but not at others.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.