Strange happenings in FullDuplexSerial
william chan
Posts: 1,326
I don't know why, but when I change the receive buffer size from 16 to 24 bytes, the transmitted bytes using the 2 transistor circuit become erratic.
When I change both buffer sizes back to 16, the transmit works well.
Should the buffer sizes be multiples of a certain number?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
When I change both buffer sizes back to 16, the transmit works well.
Should the buffer sizes be multiples of a certain number?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
Aside from changing those numbers in the tx & rx buffer size, what other changes did you make to the object to let it properly mask and wrap the buffers?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<This space for rent>
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
That was the answer I needed.
I think there should be a comment near the buffer settings to warn the user to use only powers of two.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
I am running Propeller at 40mHz and 19.2k baud.
I set both the receive and transmit buffers to 32 bytes each.
The transmit no longer works. Isn't 32 a magic number?
I set both buffers back to 16 bytes and everything works again.
I double checked and triple checked.
What could be wrong?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
It's not enough just to change the buffer size, you'll also have to look for the masks ($F)!
Frankly speaking, thats an example of very bad coding-sytle. Instead of declaring a single constant like bufferLen = 16, there are several incarnations with some deviation that could be derived from that constand (for example "bufferLen - 1").
"Magic Numbers":
The meaning is, that there are pure numbers spread in the code that aren't depending on some constant. In this example, it's the number "16" or the matching mask $F
> 40mHz
Thats damned slow!
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO
Post Edited (Nick Mueller) : 7/29/2009 10:35:33 AM GMT
<http://en.wikipedia.org/wiki/Magic_number_(programming)#Unnamed_numerical_constants>
Nick
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!
The DIY Digital-Readout for mills, lathes etc.:
YADRO