     if (adc_data_mode == CONTINUOUS_CONVERSION_MODE) {
         /* send communication register id 0x00 */
         SPI.transfer(0x00);
-        /* send read command to the data register 0x04 */
+        /* send read command 0x40 to the data register 0x04 */
         SPI.transfer(0x40 | DATA_REG);
     }
     /* read the received value 24 bits */

@return int - error code
==================================
*/
int set_adc_data_speed(int speed) {
    byte value[2];
    read_adc_register(FILTCON0_REG, value, 2);
    value[0] &= 0xE0;
    value[0] |= speed >> 7;
    value[1] |= speed;
    write_adc_register(FILTCON0_REG, value, 2);
    return 0;
}

/*
===========================
sets the adc data read mode
@param int - data read mode
@return int - error code
===========================
*/
int set_adc_data_mode(int mode) {
    byte value[2];
    /* diable continuous read mode */
    read_adc_register(IFMODE_REG, value, 2);
    value[1] &= 0xF7;
    write_adc_register(IFMODE_REG, value, 2);

    /* when continuous read mode */
    if (mode == CONTINUOUS_READ_MODE) {
        /* set the adc to continuous read mode, the data register can be read directly when DATA_READY */
        set_adc_data_mode(CONTINUOUS_CONVERSION_MODE);
        read_adc_register(IFMODE_REG, value, 2);
        value[1] |= 0x08;
        write_adc_register(IFMODE_REG, value, 2);
    /* when single conversion mode */
    } else if (mode == SINGLE_CONVERSION_MODE) {
        /* set the adc to single conversion mode, the ADC conversion has to be triggered manually */
        read_adc_register(ADCMODE_REG, value, 2);
        value[1] &= 0x8F;
        value[1] |= 0x10;
        write_adc_register(ADCMODE_REG, value, 2);
    /* when continuous conversion mode */
    } else if (mode == CONTINUOUS_CONVERSION_MODE) {
        /* set the adc to continuous conversion mode, the communication register has to be notified for a ADC read */
        read_adc_register(ADCMODE_REG, value, 2);
        value[1] &= 0x8F;
        value[1] |= 0x00;
        write_adc_register(ADCMODE_REG, value, 2);
    /* unknown data read mode */
    } else {
        return 1;
    }
    return 0;
}


    /* initiate ADC */
    init_adc();
    /* set ADC configuration */
    /* enable ch0 and ch1 */
    enable_adc_channel(CH0_REG, true);
    enable_adc_channel(CH1_REG, true);
    /* set the adc data mode */
    set_adc_data_mode(CONTINUOUS_READ_MODE);
    /* set the adc samplingrate to 1007 Hz*/
    set_adc_data_speed(SPS_1007);
    /* wait for ADC */
    delay(100);
}

void loop() {
    byte data[3];
    /* when ADC conversion is finished */
    if (DATA_READY) {
        /* read ADC conversion result */
        read_adc_data(data);
        Serial.write(data[0]);
        Serial.write(data[1]);
        Serial.write(data[2]);
    }
}