- Joined
- Jul 4, 2009
- Messages
- 16,474
- Helped
- 5,156
- Reputation
- 10,345
- Reaction score
- 5,202
- Trophy points
- 1,393
- Location
- Aberdyfi, West Wales, UK
- Activity points
- 139,397
This isn't a length issue, there is a fundamental problem with sending and receiving strings.
As far as I can tell, you do not need the Copybuff() routine at all and by duplicating the incoming data all you do is double the amount of RAM being used. What you need is a way to store incoming characters UNTIL a terminator is found. When the terminator is detected, you have time to do whatever you want before sending another command. The incoming storage buffer does not need clearing but you do need a way to 'point' (there is a hint there) to where the data is placed in the buffer and a way to reset the pointer to the start when a new string of characters arrives.
A single routine is all you need to send commands. For example "SendGSM(string);" and it can add it's own terminator so you don't have to add it to every string you send.
First though, tell us how you detect the "OK" message coming back from the modem.
Brian.
As far as I can tell, you do not need the Copybuff() routine at all and by duplicating the incoming data all you do is double the amount of RAM being used. What you need is a way to store incoming characters UNTIL a terminator is found. When the terminator is detected, you have time to do whatever you want before sending another command. The incoming storage buffer does not need clearing but you do need a way to 'point' (there is a hint there) to where the data is placed in the buffer and a way to reset the pointer to the start when a new string of characters arrives.
A single routine is all you need to send commands. For example "SendGSM(string);" and it can add it's own terminator so you don't have to add it to every string you send.
First though, tell us how you detect the "OK" message coming back from the modem.
Brian.