We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I used printf for serial print by this function:
struct __FILE { int handle;} ; //FILE __stdout; //FILE __stdin; //FILE __stderr;
int fputc(int ch, FILE *f) { while(!USART_GetFlagStatus(COM3,USART_FLAG_TXE));
USART_SendData(COM3,ch);
return ch; }
This worked but when I want to create a file and write on it with fwrite function, data send to serial!! How can I tell to micro fwrite don't use my fputc function and write data to file not serial? When I remove my fputc function, data write to file but I want to use printf for debug and I don't want to remove it.
I hope I've been able to figure out what I mean.
Regards, Alireza
Yes, I do this with SD and spi protocol. This work for me without my fputc function, but I want to have serial debug too. For write to SD I use from fwrite function, but it seem fwrite use from fputc function!