# A/D 10 bits in Silicon Laboratories C8051Fxxx ,interrupt

I am reading code in C to convert analog to digital and didn't understand this part. I didn't post the whole code but this is enough to understand the point of my questions since my questions are a bit general.

void ad_isr (void) interrupt 10     /*I didnt understand when does the program calls the interrupt and why do we need an interrupt?*/
{
voltage = highbytevoltage*256 + lowbytevoltage;
array [b] =voltage;

if (b == 31)
{
for (c=0; c!=32; c++)
{
Voltage = Voltage + array[c];
}
voltage = voltage/32;


Why do we need to sum 32 consecutive voltages and then divide by 32? Also I saw in an example code from the internet

for(i=0;i<16;i++)
{
}


So I thought they may have something with each other since 32 is the double of 16