i don’t have a program for atmega16. actually i wrote one for RD2 uC and it worked great for me. the logic remains same.
set up usart (check atmeg16 usart tutorial) with 9600 baud rate.
write serial send and serial receive function.
the next thing is to set your modem in text mode format.
the command to do so is AT+CMGF=1
now whenever a new sms is received u’ll recv this string
where SM indicates sim card and 1 is the memory location.
you have to collect these bytes in charecter array one by one.
then to read sms send this command AT+CMGR=1
after executing this command you will get your sms charecters 1 by 1.
study the message format in some terminals (like senders no and newline blah blah). i used putty. extract the string and then write/use function strcmp function.
Hope you are good at writing c codes. check out ur modem datasheet.
all the best.