Forum Discussion
Altera_Forum
Honored Contributor
13 years agoRS232C Packet Loss
Hello, I am working with my custom board, and having problem communicating via RS232C. In very rare occasion, commands seems to be ignored, lost, or thrown away. My C code is some...
Altera_Forum
Honored Contributor
13 years agoHi, I modified my codes as below,
and it's working fine so far. Just simply replaced scanf() to file descriptor. === n=0; while(1) { ////////scanf(%s, cmd); fread(&cmd[n], 1, 1, fs); if(cmd[n] == 0x0a){//LF cmd[n] = 0; break; } n++; printf("packet received\n"); } === I guess scanf() is doing something bad in my case.. mmTsuchi & dsl, Thanks for your support!