Hi, When I execute the first putchar statement in the code below, nothing is printed to the serial window, when I execute the second putchar statement, the value I thought would print out firstly (0xFF) prints out now. In the for loop I have printed the value i, but likewise the value for i prints out after executing the second putchar statement in that loop. Any ideas why this is happening? Also I have reset the value of counter1 to 2, but as I am stepping through the putchar statements, counter1 increases. I cant see how this can happen as the only way the counter can increment is in the ADC interrupt routine, but the program doesn't jump to this routine in the meantime? If anyone can help, it would be great! Lisa
if(finished) { rec1[buf].cnt = counter1; // store counter1 value in 1st element of array buf ^= 1; // set alternative buffer up counter1 = 2; // reset counter1 to original value // print out whole structure putchar(rec1[!buf].cnt); putchar((char) (rec1[!buf].base_value >> 8)); putchar((char) (rec1[!buf].base_value)); for(i = 0; i < MAX_COUNT-2; i++) { putchar(i); putchar(rec1[!buf].x[i]); } finished = 0; }