glenjoy
Banned
- Joined
- Jan 1, 2004
- Messages
- 962
- Helped
- 72
- Reputation
- 146
- Reaction score
- 20
- Trophy points
- 1,298
- Location
- Philippines
- Activity points
- 0
eda_surfer said:You can do this in one routine by having separate counters for the two frames, which look and count for the occurence of 0x0A after a special sequence of the string.
echo47 said:If those are in-memory character strings with no terminator, then it is impossible to distinguish the two forms.
Or are they disk files? You can detect the end-of-file.
0x0E? Where is that?
You haven't described your two algorithms, so we can't help you convert them into one function.
void data_A()
{
BYTE i = 0, j = 0, ECHO, DATA[];
do
{
ECHO = getc();
if(ECHO != 0x0A && ECHO != 0x0D)
{
DATA[j] = ECHO;
j++;
}
else
{
DATA[j] = ECHO;
j++;
i++;
}
} while(i<4);
}
void DATA_B()
{
BYTE j = 0, ECHO;
BYTE DATA[];
BYTE i = 0;
do
{
ECHO = getc();
if(ECHO != 0x0A && ECHO != 0x0D)
{
MESSAGE[j] = ECHO;
j++;
}
else
{
MESSAGE[j] = ECHO;
j++;
i++;
}
} while(i < 6);
}
checkmate said:I never stated that the modem AT command protocol is a lousy one, so stop putting words in my mouth. The protocol that you have showed is a lousy one.
I do not know the AT command protocol, but a quick search on the net reveals that they start with AT, and end with <Enter>. They are different from what you have. BTW, <0x0D 0x0A> is equivalent to <Enter>.
To demonstrate a simple example of non-unique decodability, assuming that "0", "01" and "001" are valid codes. An input stream 001 can mean "0"+"01" or they can mean "001". There is no unique decoding method, as "0" is a prefix of both "01" and "001".
C-Man said:Hyperterminal is not "eficient" in any way it is just a "stupid" PC program whicj must not care for memory or resources as you must do in microcontroller programming.
I was asking you if there is no way to know if the numer of received messages is 1 or 2 or ...
Is this just an answer to something that you are initiating or where do the messages you want to receive come from???
Can you post an example log of hyperterminal??
I normally do not like to squabble here as I feel that this is a technical forum for sharing. But I just blew it.glenjoy said:LOL, AT Commands replies begins with 0x0D and 0x0A and also ends with that, so before commenting about lousy protocols, try to know the facts first.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?