Full Duplex Serial object with >256 byte buffer?
Bobb Fwed
Posts: 1,119
in Propeller 1
I'm looking for a serial object with a buffer of more than 256 bytes. I've been using FullDuplexSerial_rr004 which said it could do 512 bytes when I downloaded it, though the OBEX now [correctly] says it can't. I only need 9600 baud, though it needs to be able to run at 5MHz, so I'm not sure if a SPIN object could handle that.
Comments
Thank you. I will give that one a try!
In FullDuplexSerial_rr004, in the pasm code, change two lines.
line 250 is now, change to same thing for line 272, now change to Then in the spin code, change all 3 instances of to That is in lines 93 (rxcheck) , and lines 117 and 119 (tx(txbyte))
Note that bufmsk is no longer used.
Change bufsiz to whatever value you want. It does not have to be a power of two. As written, the rx and tx buffers are the same size.
The magic is performed by the cmpsub operator, conditional subtract that wraps the pointer back to the start of the buffer.
Thanks! Worked like a charm. The new limit with these changes is 511 bytes, but that's fine for what I'm doing. I'll further modify it to separate the buffer sizes, because my tx buffer can be tiny. I only need the larger buffer for incoming messages.
not... cmpsub t3,#BUFSIZ
but... cmpsub t3,bufsiz ' where bufsiz is a register that has been initialized with a value
Can also easily have separate rx and tx buffers. One way to do it,
and the obvious changes to the spin code in lines 93, 117 and 119.
edited.