Hi all.
I' trying to read the response from one GSM module.
On my PC I'm getting the following answers:
Command: AT+CMEE=2 ( 41 54 2b 43 4d 45 45 3d 32 0d)
Answer: OK (0d 0a 4f 4b 0d 0a)
My question is, how could I know when the transmission has completed?
I want to begin decoding of the answer when the transmission has ended. Is that possible?
Thank you guys.
newguy
Joined: 24 Jun 2004 Posts: 1907
Posted: Sun Jul 22, 2007 9:17 pm
If I'm understanding the problem correctly, you'd start to process the answer (characters received from the modem) when the PIC receives 0x0d followed by 0x0a.
The way that I'd approach the problem is to use the RDA (receive data available) interrupt to simply fill a buffer with the received characters and then exit. In that ISR you'd also check to see if the last received character is 0x0a AND if the character immediately preceding it was 0x0d. When this occurs, the modem is done "spitting" out that string. Use this condition to set a flag in the ISR and in the program's main loop use that flag to start a received buffer parse/interpretation function. When that function is done, set another flag (whatever) that resets the buffer fill index.
tavioman
Joined: 22 Feb 2006 Posts: 65
Posted: Sun Jul 22, 2007 11:55 pm
Hi.
I'm controlling the GSM with RTS. I keep RTS in disable state till I'm ready to receive the string.
I have found a nice solution tough.
I'm using RDA(I use interrupts as much as I can:)) to receive the string in a 255 size buffer. I also use a timer that I start after each character. If the timer gets timeout'ed the receive is complete.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum