Dear friends my application is that when i give 3 ring to the gsm connected with controller one relay should be ON and if i give 4 ring to it another relay should ON. can any one help me with this and thanks in advance!!!!!!
You need to re-think your idea - this will not, in general, work.
See, for example: www.8052.com/.../107648
And: www.8052.com/.../107672
How would you count the number of ring signals?
Do you think you will hear in your phone how many ring signals the GSM module have detected?
Note that the GSM module is communicating digitally with the GSM network. So a ring signal is not an acousting signal send on the speech channel.
As explained in the items linked earlier, the same applies to the analogue PSTN.
See my post about the WikiBooks "Serial Programming/Modems and AT Commands" in this thread: http://www.keil.com/forum/18696/