related to increase speed of ADC

In Arduino Due, we did this program to increase speed of ADC for comparison of sine-triangular wave, but we didn’t get output.so please give your suggestions…we generated triangular wave internally any sine wave given externally…

#include “Waveforms.h”

int i = 0;
int sample;
int a;
int b;

void setup()

{
int t=analogRead(0);
ADC->ADC_MR|=0x08;
ADC->ADC_CR=2;
ADC->ADC_CHER=0x80;

// analogReadResolution(16);
pinMode(13,OUTPUT);

}
void loop()
{
int t=micros();
int q=0;
int a0;
for(i=0;i<1000000;i++)
{
while((ADC->ADC_ISR & 0x80)==0);
a0=ADC->ADC_CDR[7];
q+=a0;
}

t=micros()-t;

if(a0>waveformsTable*)*

  • {*

  • digitalWrite(13,HIGH);*

  • }*

  • else*

  • {*

  • digitalWrite(13,LOW);*

  • }*

  • i++;*

  • if(i == maxSamplesNum) *

  • i = 0;*

  • }*
    //Waveform.H
    #ifndef Waveforms_h
    #define Waveforms_h

#define maxSamplesNum 467

static int waveformsTable[maxSamplesNum] = {

  • // Triangular wave*

  • 0x0, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, //0x90,*

  • 0xa0,*

  • 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0x100, //0x110,*

  • // 0x120,*

  • 0x130, 0x140,*

  • 0x150, 0x160, 0x170, 0x180, //0x190,*

  • 0x1a0, 0x1b0, 0x1c0, 0x1d0, 0x1e0,*

  • 0x1f0, 0x200, //0x210,*

  • // 0x220,*

  • 0x230, 0x240, 0x250, 0x260, 0x270, 0x280,*

  • //0x290,*

  • 0x2a0, 0x2b0, 0x2c0, 0x2d0, 0x2e0, 0x2f0, 0x300, //0x310,*

  • // 0x320,*

  • 0x330, //0x340,*

  • 0x350, 0x360, 0x370, 0x380, //0x390,*

  • 0x3a0, 0x3b0, 0x3c0,*

  • 0x3d0, 0x3e0, 0x3f0, 0x400, 0x410,// 0x420,*

  • 0x430, 0x440, 0x450, 0x460,*

  • 0x470, 0x480,// 0x490,*

  • 0x4a0, 0x4b0, 0x4c0, 0x4d0, 0x4e0, 0x4f0, 0x500,*

  • 0x510, 0x520, 0x530, 0x540, 0x550, 0x560, 0x570, 0x580, //0x590,*

  • 0x5a0,*

  • 0x5b0, 0x5c0, 0x5d0, 0x5e0, 0x5f0, 0x600, 0x610, 0x620, 0x630, 0x640,*

  • 0x650, 0x660, 0x670, 0x680, //0x690,*

  • 0x6a0, 0x6b0, 0x6c0, 0x6d0, 0x6e0,*

  • 0x6f0, 0x700, 0x710, 0x720,0x730 ,0x740,0x750,0x760,0x770,0x780,//0x790,*

  • 0x7a0,0x7b0,*

  • 0x7c0, 0x7d0, 0x7e0, 0x7f0, 0x800, 0x810,*

  • 0x820, 0x830, 0x840, 0x850, 0x860, 0x870, 0x880, //0x890,*

  • 0x8a0, 0x8b0, 0x8c0,*

  • 0x8d0, 0x8e0, 0x8f0, 0x900, 0x910, 0x920, 0x930, 0x940, 0x950, 0x960,*

  • 0x970, 0x980,// 0x990,*

  • 0x9a0, 0x9b0, 0x9c0, 0x9d0, 0x9e0, 0x9f0, 0xa00,*

  • 0xa10,0xa20, 0xa30, 0xa40, 0xa50, 0xa60, 0xa70, 0xa80, //0xa90,*

  • 0xaa0,*

  • 0xab0, 0xac0, 0xad0, 0xae0, 0xaf0, 0xb00 ,0xb10, 0xb20, 0xb30, 0xb40,*

  • 0xb50, 0xb60, 0xb70, 0xb80, //0xb90,*

  • 0xba0,0xbb0, 0xbc0, 0xbd0, 0xbe0,*

  • 0xbf0, 0xc00, 0xc10, 0xc20, 0xc30, 0xc40, 0xc50, 0xc60, 0xc70, 0xc80,*

  • // 0xc90,*

  • 0xca0, 0xcb0, 0xcc0, 0xcd0, 0xce0, 0xcf0, 0xd00, 0xd10, 0xd20,*

  • 0xd30, 0xd40, 0xd50, 0xd60, 0xd70, 0xd80,// 0xd90,*

  • 0xda0, 0xdb0, 0xdc0,*

  • 0xdd0, 0xde0, 0xdf0, 0xe00, 0xe10, 0xe20, 0xe30, 0xe40, 0xe50, 0xe60,*

  • 0xe70, 0xe80, //0xe90,*

  • 0xea0, 0xeb0, 0xec0, 0xed0, 0xee0, 0xef0, 0xf00,*

  • 0xf10, 0xf20, 0xf30, 0xf40, 0xf50, 0xf60, 0xf70, 0xf80, 0xf90, 0xfa0,*

  • 0xfb0, 0xfc0, 0xfd0, 0xfe0, 0xff0, 0x1000, 0xff0, 0xfe0, 0xfd0, 0xfc0, 0xfb0,*

  • 0xfa0, 0xf90, 0xf80, 0xf70, 0xf60, 0xf50, 0xf40, 0xf30, 0xf20, 0xf10,*

  • 0xf00, 0xef0, 0xee0, 0xed0, 0xec0, 0xeb0, 0xea0, //0xe90,*

  • 0xe80, 0xe70,*

  • 0xe60, 0xe50, 0xe40, 0xe30, 0xe20, 0xe10, 0xe00, 0xdf0, 0xde0, 0xdd0,*

  • 0xdc0, 0xdb0, 0xda0, //0xd90,*

  • 0xd80, 0xd70, 0xd60, 0xd50, 0xd40, 0xd30,*

  • 0xd20, 0xd10, 0xd00, 0xcf0, 0xce0, 0xcd0, 0xcc0, 0xcb0, 0xca0, //0xc90,*

  • 0xc80, 0xc70, 0xc60, 0xc50, 0xc40, 0xc30, 0xc20, 0xc10, 0xc00, 0xbf0,*

  • 0xbe0, 0xbd0, 0xbc0, 0xbb0, 0xba0,//0xb90,*

  • 0xb80,0xb70,0xb60,0xb50,0xb40,0xb30,0xb20,0xb10,*

  • 0xb00, 0xaf0, 0xae0, 0xad0, 0xac0,*

  • 0xab0, 0xaa0, //0xa90,*

  • 0xa80, 0xa70, 0xa60, 0xa50, 0xa40, 0xa30, 0xa20,*

  • 0xa10, 0xa00, 0x9f0, 0x9e0, 0x9d0, 0x9c0, 0x9b0, 0x9a0,// 0x990,*

  • 0x980,*

  • 0x970, 0x960, 0x950, 0x940, 0x930, 0x920, 0x910, 0x900, 0x8f0, 0x8e0,*

  • 0x8d0, 0x8c0, 0x8b0, 0x8a0, //0x890,*

  • 0x880, 0x870, 0x860, 0x850, 0x840,*

  • 0x830, 0x820, 0x810, 0x800, 0x7f0, 0x7e0, 0x7d0, 0x7c0, 0x7b0, 0x7a0, //0x790,*

  • 0x780, 0x770, 0x760, 0x750, 0x740, 0x730, 0x720, 0x710, 0x700, 0x6f0,*

  • 0x6e0, 0x6d0, 0x6c0, 0x6b0, 0x6a0, //0x690,*

  • 0x680, 0x670, 0x660, 0x650,*

  • 0x640, 0x630, 0x620, 0x610, 0x600, 0x5f0, 0x5e0, 0x5d0, 0x5c0, 0x5b0, 0x5a0,*

  • //0x590,*

  • 0x580, 0x570, 0x560, 0x550, 0x540, 0x530, 0x520, 0x510, 0x500,*

  • 0x4f0, 0x4e0, 0x4d0, 0x4c0, 0x4b0, 0x4a0, //0x490,*

  • 0x480, 0x470, 0x460,*

  • 0x450, 0x440, 0x430,// 0x420,*

  • 0x410, 0x400, 0x3f0, 0x3e0, 0x3d0, 0x3c0,*

  • 0x3b0, 0x3a0, //0x390,*

  • 0x380, 0x370, 0x360, 0x350, //0x340,*

  • 0x330,// 0x320,*

  • // 0x310,*

  • 0x300, 0x2f0, 0x2e0, 0x2d0, 0x2c0, 0x2b0, 0x2a0, //0x290,*

  • 0x280,*

  • 0x270, 0x260, 0x250, 0x240, 0x230, //0x220, //0x210,*

  • 0x200, 0x1f0, 0x1e0,*

  • 0x1d0, 0x1c0, 0x1b0, 0x1a0, //0x190,*

  • 0x180, 0x170, 0x160, 0x150, 0x140,*

  • 0x130,// 0x120, //0x110,*

  • 0x100, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0,*

  • //0x90,*

  • 0x80, 0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x0 *

  • };*

#endif

Now, again please, without italics.