I taste this : "If time=0 then porta.0 = 0" but not working
Which PIC are you using?

Have you set TRISA.0=0 so PORTA.0 is an output?