Thanks lot Darrel,I m very happy to see ur reply.

can i use the same codings for zerocrossing?bcoz zero crossing will occur every rising or falling edge.plz correct me if i am wrong?