Converting a piece of PIC code to Arduino

I didn't define the other pins as OUTPUT

In Arduino, all pins that are to be used for output must be declared OUTPUT.

The point is not to duplicate the PIC code, it is to make the ATMega processor act exactly like the PIC processor in the application.

To do that, you have to know exactly what the PIC is doing, and follow all the Arduino language rules to make the ATMega processor do exactly the same thing.

Why are you doing this? Why not just use a PIC?