Go Down

Topic: Arduino Due Fast Sampling positive Negative Voltage (Read 95 times) previous topic - next topic


Hi, Im trying to achieve a Negative Positive reading with Arduino Due,
i ve reach the 1 uS with Free Running Mode but cant figure out how to read the  negative Voltage.

int x;                                           
long t;
int m[10000]={0};

int i=0;
void setup()
  Serial.begin(9600);                            // initialize the serial port:
  ADC->ADC_MR |= 0x80;                        // these lines set free running mode on adc 7 (pin A0)
  REG_ADC_MR = 0x10380180;                     // change from 10380200 to 10380180, 1 is the PREESCALER and 8 means FREERUN
  ADC -> ADC_CHER = 0x80;                        // enable ADC on pin A0


void loop() {
 //t = micros();                    // init time an elapsed time, in micro seconds
   while((ADC->ADC_ISR & 0x80)==0);             // wait for conversion
    x = ADC->ADC_CDR[7];
    if (x>1000){
  for(int i = 0; i < 10000; i++) {
    // instrucction to measure
    while((ADC->ADC_ISR & 0x80)==0);             // wait for conversion
    x = ADC->ADC_CDR[7];                         // read value A0
                          // 2 us is nothing measured time
  for(int i=0; i<10000; i++){
        byte   j=map(m,0,4095,0,255);
//  t = micros()-t;                          // 2 us is nothing measured time


i have an idea for using DC offset but dont know how to put it in a Code

thanks everyone!

Go Up