USART.Read 2-character limit?
Posted: Tue May 17, 2016 9:53 pm
Hi, I have a question about the Swordfish USART read function when it comes to strings. It seems I can only read 2 ASCII characters from the USART.Read(myString) call. I'm using a PIC18F46K22 which has a 2-byte EUSART receive buffer. I've read most string receiving routines use a circular buffer to store incoming data, and I'd assumed the Swordfish USART library would implement a technique like that, allowing to receive strings of more than 2 bytes length. Unfortunately, the USART.Receive(myString) command becomes permanently blocking if I send a continuous stream of more than two bytes as a string.
But, the USART.Read() function works fine if I manually type into a terminal program (i.e., the character bytes are spaced out by keystroke interval). If I send those bytes continuously, it hangs.
This limitation doesn't depend on the baud rate. I can copy some code here, though I'm guessing there's something I might be missing or that someone else already knows the answer to receiving more than 2 characters as a string with this library module. It seems I should be able to beam a simple "Hello World" + terminator string as a single line transmission and have the USART routine get the whole string. So far all it's willing to receive is "H" + terminator or the terminator alone, if I send the item as a single transmission, though it works if I type each letter (and send them spaced out in time).
Any ideas?
Graham
But, the USART.Read() function works fine if I manually type into a terminal program (i.e., the character bytes are spaced out by keystroke interval). If I send those bytes continuously, it hangs.
This limitation doesn't depend on the baud rate. I can copy some code here, though I'm guessing there's something I might be missing or that someone else already knows the answer to receiving more than 2 characters as a string with this library module. It seems I should be able to beam a simple "Hello World" + terminator string as a single line transmission and have the USART routine get the whole string. So far all it's willing to receive is "H" + terminator or the terminator alone, if I send the item as a single transmission, though it works if I type each letter (and send them spaced out in time).
Any ideas?
Graham