void ADC(void) __attribute__ ((interrupt_handler,section(".icode")));
void ADC(void)
{
    static unsigned int channel IBSS_ATTR;
    /* read current value */
    adc_data[(channel & 0x03)] = ADVALUE;

    /* switch channel
     *
     * set source remark
     * ADCONFIG is 16bit wide so we have to shift data by 16bits left
     * thats why we shift <<24 instead of <<8
     */

    channel++;

    and_l(~(3<<24),&ADCONFIG);
    or_l( (((channel & 0x03) << 8 )|(1<<7))<<16, &ADCONFIG);

}