Code that worked in Uno/Nano is not working in Mega - help me port the code to Mega I used the code from this project... to build an oscilloscope-like project. It worked fine with Uno and Nano. 

Later I tried to do the same with a Mega, but I don't know what's wrong. It's not working! Maybe due to some pin or port number mismatch (I think so...). Because it has some low level code like:

------------------------------------------------------
// set up 8 MHz timer on pin 9    
pinMode (9, OUTPUT); 
// set up Timer 1    
TCCR1A = _BV (COM1A0);  // toggle OC1A on Compare Match    
TCCR1B = _BV(WGM12) | _BV(CS10);   // CTC, no prescaling    
OCR1A =  0;       // output every cycle    
---------------------------------------------------------


And like:

Data.Values[i]=PINC;


I have very little knowledge about these registers.

Please help me port this code to Mega and make it work...
There is some concept you would have to learn before you can go from Arduino Uno to Mega.
Because your project is designed to operate on Arduino Uno R3, the registers operations like below are specific to the microcontroller in Arduino Uno - in this case ATmega328P-PU - datasheet here
TCCR1A = _BV (COM1A0);  // toggle OC1A on Compare Match
 TCCR1B = _BV(WGM12) | _BV(CS10);   // CTC, no prescaling 
 OCR1A =  0;
You can find description of registers in mentioned datasheet in chapter 19. TC0 - 8-bit Timer/Counter0 with PWM
Now, you grab another datasheet - one which describes ATmega2560 (yes, this is microcontroller which is sitting in Arduino Mega), find corresponding pin (like OC1 in Uno - check the drawing below):

and find proper pin and corresponding register from ATmega2560 datasheet.
Take a look at the schematic picture first, select one of OCx pins and configure what is needed.
Pins from Aruino Mega with OCR functionality:

and

You need to learn what registers are, and what they can do. Can be a little demanding task, but believe me - this will give you supernatural powers in microcontrollers world ;)