Arduino mega and Rotary encoder

hello everyone,

I have a little problem with my arduino and the Rotary encoder.
my arduino works via a PC psu, when i turn it off.
The arduino counts up with the encoder. And what every I do it do not change it.
But if i turn the psu on it's stops but don't do anything with the encoder.
don't count up or down when I play with it.
I used so many code's. And nothing wil help me out.
I usde the pin 19 & 18 of my Atmega.

Can somebody have a idea? Because i have no idea why even with startup code. I have these same problem and sorry for my English

Greets

PJ

If nobody replies with a useful answer, consider...

1: Nobody can see code you're running.
2: The hardware you're using and how you've actually wired it is also invisible (other than using pins 18 & 19)
3: You posted this in the Arduino 101 section, even though you're using Arduino Mega.

Maybe try posting in the correct area, and show the code, precise info about which parts you're using, and a photo of how you actually made the connections.

Good English is not required, but good info is.