Reading ADC value and continually send the data to PC, or a few values at a time

Hello.

I have a really hard time getting to grips with the Due, I had just about learned the 8-bit architecture but my programming skills is non-existing. Though I will not give up untill I do understand the Due, but I found my self facing a big wall when I tried to read a ADC pin and then send the value to my PC to process with matlab. I know that I could and should interface my Due with matlab but I can't, I get a 0x0000142 error which ever arduino I try, Uno, Mega or Due and I can't figure out how to fix it and I have spent hours trying.

But I just to test it created a sine wave with the Due and read the output with a analog pin and printed the values to the serial monitor, but that became troublesome since I could not write to the dac and read the adc value as I liked to. First I wrote a sinewave lookup table to the DAC with a for loop, but then I got stuck and I tried to read the ADC in the same loop and to read the ADC outside the loop with free-running mode but it all fell apart.

I'm not sure if I am trying anything that is even possible or if I am simply a lousy programmer, I sure am but I'm learning.

Since I cannot connect directly to matlab I want to write a CSV file to a file on the PC but I have hit a brick wall and I could really need some directions, shouldn't I be able to direct the SAM3X8E to write to a file without the CPU...

This is using parts of a sketch found online: setup: ADC->ADC_MR |= 0x80; //set free running mode on ADC ADC->ADC_CHER = 0x80; //enable ADC on pin A0

loop: while((ADC->ADC_ISR & 0x80)==0); // wait for conversion Serial.print(ADC->ADC_CDR[7]); Serial.print(",");

but after a little while the IDE flipps out and crashes, I need a better way of getting lots and lots of values for processing. I'm searching google for solutions but I don't fins any that appeals to me, do I have to use some other software to write to a .txt file or can it be done from the arduino alone?

Why not use analogRead() ?