DDRL |= (WR | SH | ICG | MCLK | RD | DBG); // Set the clock lines to outputs
OR-ing together a bunch of Arduino pin numbers will NOT get you a useful bitmask. Use pinMode() instead of writing directly into the Data Direction Register. Use digitalWrite() to set output pins instead of writing to the PORT register. ONLY USE DIRECT REGISTER ACCESS IF YOU REALLY NEED THE SPEED OR NEED TO CHANGE MORE THAN ONE PIN IN THE SAME MICROSECOND.
Ok, thank you, now seems to work.
But actually I need the speed, I want to use a CCD too. This was only a test for the ADC.
Is there a solution? I don't understand why that code doesn't work for me.
PORTD = (1<<WR); //WR high
PORTD = (1<<RD); //RD high
That's a mistake if you want both bits set. When you write a PORT register you set all 8 bits. Setting the RD bit is also clearing all the other bits, including WR.
Also, port registers are only 8 bits wide. Shifting a 1 by 20 or 21 bits moves it completely out of the byte. TO MANIPULATE PINS USING DIRECT PORT MANIPULATION YOU NEED TO USE THE PORT NAME AND PIN MASK. YOU CAN"T DIRECTLY USE ARDUINO PIN NUMBER. Find a chart or diagram that maps maps Arduino pin numbers to port names in pin mask (or bit number you can use for shifting).