A/D convertor

What could be the problem that I can not upload this cod to UNO

// The encoder angle is measured as an angle fro 0 - 1023 "binary degrees".
// These arrays define at which angles the Hall signals H1 (Pin 2) H2 (pin 3) and H3 (pin 4) are high.
// H1 = {0, 171, 341, 512, 683, 853) would set the H1 pin high between 0-60, 120-180 and 240-300 degrees
// Which might suit a 3 pole motor.
// All three arrays must have the same number of elements set by the NUMSEGS constant.
// Angle-wrapping is not supported, 0 is always less then 1023.

// Quadrature signals are A (pin 5), B (pin 6), Z (pin 7)

// Resolver Cos+ is Analog(0), Sin+ is Analog(2)

// 31kHz PWM Sine wave excitation Pin11 (low pass filter / buffer required)

#include "avr/pgmspace.h"
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

const char NUMSEGS = 8;

int H1[] = {0, 171, 341, 512, 683, 853, 1025, 1025};
int H2[] = {114, 284, 455, 626, 796, 967, 1025, 1025};
int H3[] = {0, 58, 228, 398, 569, 740, 910, 1023};
byte i1;
byte i2;
byte i3;

// table of 256 sine values / one sine period / stored in flash memory
PROGMEM prog_uchar sine16[] = {127, 176, 217, 245, 255, 245, 217, 176, 128, 79, 38, 10, 0, 10, 38, 79, 127 };

PROGMEM prog_uchar arctan256[] = {
0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 18, 18, 19, 20,
20, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 34, 35, 36, 36, 37,
38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, 45, 45, 46, 46, 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53,
54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69,
69, 70, 70, 71, 71, 72, 72, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83,
84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96,
96, 97, 97, 98, 98, 99, 99, 99, 100, 100, 101, 101, 102, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106,
106, 107, 107, 108, 108, 108, 109, 109, 110, 110, 110, 111, 111, 112, 112, 112, 113, 113, 113, 114, 114, 115, 115,
115, 116, 116, 116, 117, 117, 118, 118, 118, 119, 119, 119, 120, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123,
123, 124, 124, 124, 125, 125, 125, 126, 126, 126, 127, 127, 127, 128, 128, 128
};

byte EP0[] = { B00000000, B00100000, B01100000, B01000000 };

volatile byte V[6]; // Analogue values
byte Z[6]; // Zero-offset values for each channel
volatile boolean F; // "You have new Volts" flag.

signed int Q; // Three Quadrature encoders
signed int A; // Three Angles
long Accum; // For zero-measurement

volatile byte index; // index to current mux channel

byte oldindex = 0; // Only do arctan if there is new data
// variables used inside interrupt service declared as voilatile
volatile byte icnt; // var inside interrupt

void setup()
{
DDRB = B00111111; // PORTB as output
DDRD = B11111100; // PortD as output, except serial IO
Serial.begin(115200); // connect to the serial port
Serial.println("Resolver to Hall Converter");

//First populate the zero-volt value for each channel
analogReference(EXTERNAL);
for (int i = 0 ; i <= 5 ; i++) { // iterate through channels
Accum = 0;
for (int j = 1 ; j<=1000 ; j++) { // 1000 samples should do
Accum = Accum + analogRead(i);
}
Z = Accum / 4000; // 10-to-8 bitshift and 1000
_ Serial.println(Z*, DEC);_
_
}*_

* Setup_timer2();
_
// disable interrupts to avoid timing distortion*_
* cbi (TIMSK0,TOIE0); // disable Timer0 !!! delay() is now not available*

* SetupADC();*
}
void loop()
{
* sbi (TIMSK2,TOIE2); // enable Timer2 Interrupt*

* // Main loop*

* while(1) {*
* if (F) // Only bother updating angle and Hall signals after a new angle measurement*
* {*
* F = false;*
* A = arctan(V[0] - Z[0], V[3] - Z[3]);*
* // Set the Hall Sensors*
* i1 = i2 = i3 = 0;*
* for (int n = 0 ; n < NUMSEGS; n++){*
* if (A > H1[n]) i1++;*
* if (A > H2[n]) i2++;*
* if (A > H3[n]) i3++;*
* }*
* if (i1 & 1) sbi(PORTD, 2);*
* else cbi(PORTD, 2);*

* if (i2 & 1) sbi(PORTD, 3);*
* else cbi(PORTD, 3);*

* if (i3 & 1) sbi(PORTD, 4);*
* else cbi(PORTD, 4);*
* }*
* // Count till the Quadrature counter equals the angle*
* if ((Q < A && int(A - Q) < 512) || int(Q - A) > 511 ) Q = (1023 & ++Q) ;*
* else if ((Q > A && int(Q - A) < 512) || int(A - Q) > 511) Q = (1023 & --Q) ;*
* PORTD = (PORTD & B10011111) | EP0[Q & 3];*
* if (Q == 0) sbi(PORTD, 7);*
* else cbi(PORTD,7);*
* }*
}
//******************************************************************
// timer2 setup
// set prscaler to 1, PWM mode to phase correct PWM, 16000000/510 = 31372.55 Hz clock
void Setup_timer2() {
* sbi (TCCR2B, CS20); // Timer2 Clock Prescaler to : 1*
* cbi (TCCR2B, CS21);*
* cbi (TCCR2B, CS22);*
* // Timer2 PWM Mode set to Phase Correct PWM*
* cbi (TCCR2A, COM2A0); // clear Compare Match*
* sbi (TCCR2A, COM2A1);*
* sbi (TCCR2A, WGM20); // Mode 1 / Phase Correct PWM*
* cbi (TCCR2A, WGM21);*
* cbi (TCCR2B, WGM22);*
}
//Setup ADC
void SetupADC() {
// cbi(ADMUX, REFS1);
//cbi(ADMUX, REFS0); // External Aref
analogReference(EXTERNAL);
sbi(ADMUX, ADLAR); // Left-aligned for 8-bit data
cbi(ADMUX, MUX3);
cbi(ADMUX, MUX2);
cbi(ADMUX, MUX1);
cbi(ADMUX, MUX0); // Set the Mux to zero to begin

sbi(ADCSRA, ADEN); // Enable the ADC
cbi(ADCSRA, ADSC); // Don't start conversion yet
cbi(ADCSRA, ADATE); // No auto-trigger
cbi(ADCSRA, ADIF); // Not sure if that is possible or wise
sbi(ADCSRA, ADIE); // Conversion-complete Interrupt to process data
sbi(ADCSRA, ADPS2);
cbi(ADCSRA, ADPS1);
cbi(ADCSRA, ADPS0); // ADC Clock prescalar = 16
}
//******************************************************************
// Timer2 Interrupt Service at 31372,550 KHz = 32uSec
// this is the timebase REFCLOCK for the DDS generator
ISR(TIMER2_OVF_vect) {
* icnt= 15 & (++icnt); // Choose the next value from the lookup table, with wrap*
* OCR2A=pgm_read_byte_near(sine16 + icnt); // Set the PWM duty for this cycle*
* if (icnt == 5 || icnt==7 ) {*
* sbi(ADCSRA, ADSC); // Start Conversion*
* }*
}
// ADC Conversion Complete Interrupt
ISR(ADC_vect) {
V[index] = ADCH; //get the data
F = true;
index = (index == 0) ? index = 3 : index = 0 ; // swap between active channels
ADMUX = (ADMUX & B11110000) | index; // set the ACDC channel
}
// Lookup-Table based Arctan function
int arctan(int V1, int V2) {
* //Handle the quadrants explicitly*
* if (V1 < 0)*
* {*
* if (V2 < 0)*
* {*
* if (V1 < V2) // 180-225*
* {*
return 512 + pgm_read_byte_near(arctan256 + 256 * V2 / V1);
* }*
* else // 225-270*
* {*
return 768 - pgm_read_byte_near(arctan256 + 256 * V1 / V2);
* }*
* }*
* else // V2 => 0*
* {*
* if (-V1 < V2) // 90-135*
* {*
return 256 + pgm_read_byte_near(arctan256 - 256 * V1 / V2);
* }*
* else // 135-180*
* {*
return 512 - pgm_read_byte_near(arctan256 - 256 * V2 / V1);
* }*
* }*
* }*
* else // V1 => 0*
* {*
* if (V2 < 0)*
* {*
* if (V1 < -V2) // 270-315*
* {*
return 768 + pgm_read_byte_near(arctan256 - 256 * V1 / V2);
* }*
* else // 315-360*
* {*
return 1024 - pgm_read_byte_near(arctan256 - 256 * V2 / V1);
* } *
* }*
* else // V2 => 0*
* {*
* if (V1 < V2) // 45-90*
* {*
return 256 - pgm_read_byte_near(arctan256 + 256 * V1 / V2);
* }*
* else // 0-45*
* { *
return pgm_read_byte_near(arctan256 + 256 * V2 / V1);
* } *
* } *
* }*
}

Maybe the compiler didn't like the italics.

Maybe the IDE posted an error message.

Use code tags when you post code, to make it more readable and keep formatting from getting munged.

Whenever you are asking for help with a software issue, always post the full text of any and all errors received.

And when there ' s an " if not the same problem
what is missing
thanks

PROGMEM

this is my introduction to Arduino whether you can help me what to do but I'm trying not to go
Thank you very much for your answers

You need to index the array Z as Z in setup...