I have change my code as you suggested. I can see the SEN, PEN bits are cleared by hardware, but SSPIF is not set to 1. My program still stuck at while(!SSPIF);
I had been successful with software i2c to display timer with ds1307. Now I try with hardware i2c and there is a problem. The i2c bits doesn't automatically cleared by hardware.