as i said, you want to use LATD instead of PORTD. Pulsout also do more than a single PORT/LAT=x. If my memory serves me well it set the TRIS.. then do what it has to do. Hence wasting a few instruction cycle before and after... why the R-M-W behaviour don't happen.. or is reduced to a minimum.