Full Duplex questions
Zap-o
Posts: 452
Ok I want to learn so please note I am aware of other objects that can do as I am about to ask.
I want to know how to compare a bye string with the rx_buffer[noparse][[/noparse] 16 ] in FullDuplexSerial. is this possible?
So far I am playing with the following
More code would then
Now it seems redundant to have the Rx array in this main cog when there is a buffer already in the Fullduplexserial named rx_buffer[noparse][[/noparse] 16 ]. Is this possible to access?
I want to know how to compare a bye string with the rx_buffer[noparse][[/noparse] 16 ] in FullDuplexSerial. is this possible?
So far I am playing with the following
Var Byte Rx[noparse][[/noparse] 16 ] Dat Str1 Byte "Hello",0 Pub Main | idx, CheckByte Repeat CheckByte := Serial.rxcheck IF CheckByte+1 Rx[noparse][[/noparse] idx ] := CheckByte idx++ ELSE Idx := 0
More code would then
IF StringComp(@rx,str1) Serial.str(string("matched")) else Serial.str(string("No match"))
Now it seems redundant to have the Rx array in this main cog when there is a buffer already in the Fullduplexserial named rx_buffer[noparse][[/noparse] 16 ]. Is this possible to access?
Comments
there is are objects in the obex that can do a part of the work:
Extended Full Duplex Serial which provides a method that can receive strings
Strings that provide methods for stringmanipulation, finding a substring etc.
I would NEVER use the rx_buffer directly. As the content of the rx-buffer can change in the backround at any unpredictable time.
FullDuplexSerial starts another cog to be ready to receive data at any time and catch it. The new bytes are filled in into
the circular buffer immediatly.
best regards
Stefan
How about a new FullDuplexSerial that allows the user to "easily" change the receive and transmit buffer sizes?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
I guess its me but the notion that I would have to use 2 cogs to communicate to the PC is wasteful. I will stick to the FullDulexSerial object. On a related note can the buffer be increased?
You might look at several of the alternative serial drivers like obex.parallax.com/objects/397/ and obex.parallax.com/objects/340/ and obex.parallax.com/objects/398/.