Yeah this works fine.But there is another problem
When i send my first modem configuration message(at+cmgs=1),the response is an OK.After this i send the at+cmgs command.Now when i search for DM[1] it has another ascii value(13 for Carriage return) in it and not ascii value 62.When i check the position of ascii value 62 in the COMM port it comes after 8 response characters 13(CR),10(NEXT LINE),79(O),75(K),13,10,13,10,62. So how in my program can i check for this rather than for checking DM[1],since only 1 bit is read at a time from COMM port.