??? 06/13/06 11:14 Read: times |
#118213 - You can use circular buffer Responding to: ???'s previous message |
You may try to approach as follows:
1. A circular buffer of 18+1 bytes (atleast double of maximum package in your case 9 bytes)with Getpointer and Putpointer. If both the pointer is equal then buffer is empty and after incoming character is received, it is to be stored @Putpointer and putpointer get incremented with buffer size wrap around. After incrementing if putpointer is equal to getpointer, you have buffer full condition and may use a flag to signal this. I normally will not allow this condition to happen and if happen the character will get discorded. The addvantage of above method is you need not disable the interrupt while accessing the circular buffer via Getpointer. 2. Each package if contains valid start and end characters, then do not store without a valid start and on the valid start, start a maximum timeout within which you should get the all the characters of the package. On timeout clear the buffer which is equal Getpointer = Putpointer(may be required to disable interrupt here). 3.Successful reception will go for decoding the package and updation counter etc. V.Nagarajan |
Topic | Author | Date |
Buffer management optimalization | 01/01/70 00:00 | |
Simple things first ... | 01/01/70 00:00 | |
You can use circular buffer | 01/01/70 00:00 | |
Fragmentation problem... | 01/01/70 00:00 | |
all methods have some problems | 01/01/70 00:00 | |
Start of package or End of package | 01/01/70 00:00 | |
Packages explanation | 01/01/70 00:00 | |
Individual buffers | 01/01/70 00:00 | |
Good Idea | 01/01/70 00:00 | |
New packages | 01/01/70 00:00 | |
hash table unefective | 01/01/70 00:00 | |
why keep that many | 01/01/70 00:00 | |
Reason of 5 or more buffer | 01/01/70 00:00 | |
Protocol specifics | 01/01/70 00:00 | |
One way protocol | 01/01/70 00:00 | |
One way protocol | 01/01/70 00:00 | |
never | 01/01/70 00:00 | |
Definition of need | 01/01/70 00:00 | |
Grant, I agree with what you post re thi | 01/01/70 00:00 | |
Simply reason why one way transmission | 01/01/70 00:00 | |
then why not just do it the easy way![]() | 01/01/70 00:00 |