??? 03/09/07 11:05 Modified: 03/09/07 11:40 Read: times |
#134632 - Why the need of circular buffer? Receiving? Responding to: ???'s previous message |
How does the modem behave once it accepted a command and output a string response, let's say "OK"? Unlike the "send command" counterpart, there is no hardware mechanism to stop the the string("OK")from flowing into the SBUF (via RxD), is there? Therefore, how can i time and fetch the response of each character 'O' and 'K' respectively without missing any of them?
1. Is the flag RI alone sufficient to care of this job? Meaning, i will just configure SCON (specifically REN) to receive character and monitor RI for each successful sent character into the SBUF, transferring the SBUF content into a permanent location, and letting next character to be retrieved into SBUF. Does it works this way? (In another word, how does the modem knows that the SBUF is full and awaiting processing before it is allowed to send the next character) Alternatively, would it be easier if i just configure the modem to output decimal value as response indication? (0 = "OK", 4 = "ERROR", 6 = "NO DIALTONE", etc.) By doing this, i do not have to worry about receiving multi-bytes data. 2. Or is this where circular buffer comes into play? I do not really understand about how is this being used, i hope you would be kind enough to elaborate a little more about this :) Yes i have read a little about circular buffer and how it works but i cant seem to relate it to my problem at the moment. P/S-The code suggested by you was obviously clearer and easier to manipulate as you have mentioned. Thanks for the tips! |