CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

GSM response issue.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tavioman



Joined: 22 Feb 2006
Posts: 65

View user's profile Send private message

GSM response issue.
PostPosted: Sun Jul 22, 2007 5:12 am     Reply with quote

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)

Command: AT+CPIN (41 54 2b 43 50 49 4e 0d)
Answer: +CPIN: READY (0d 0a 2b 43 50 49 4e 3a 20 52 45 41 44 59 0d 0a)
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

View user's profile Send private message

PostPosted: Sun Jul 22, 2007 9:17 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jul 22, 2007 11:55 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group