# problems with PWM input

Hello

I program a nano arduino with PWM inputs. (atmega 328)

So I naturally use the input 2, 3, 4, 5

Inputs 2 and 3 with a hardware interrupt.

I found a problem with the input signals:

I have outliers on my entries 4 and 5. Values ??that rise up to 19,000 pwm. (entries 2 and 3 works perfectly)

I solved the problem by putting my entry 7 and 11. I do not have the outliers.

Someone have a logical explanation to this problem ? But also to the fact that shifting the inputs 4, 5 to 7 and 11 the problem disappears?

ps : excuse me for my bad english.

I program a nano arduino with PWM inputs. (atmega 328)

You might have analog inputs. They might be generated by PWM output somewhere. You do not have PWM inputs, though.

So I naturally use the input 2, 3, 4, 5

I don't see what is natural about that. Are those digital pin numbers or analog pin numbers?

Inputs 2 and 3 with a hardware interrupt.

Are you using pins 2 and 3 for interrupts or for analog input?

I have outliers on my entries 4 and 5. Values ??that rise up to 19,000 pwm.

This makes no sense.

You need to post your code and a schematic.

I use The input 2, 3, 4, 5 as digital input. I use it to have PWM input.

I have pwn input using code like that :

this is an exemple for the entries 2 and 3 (i'm using interrupt)
void handleInterrupt0()
{
if(int2)
{
tStart0=micros(); // we got a positive edge
}
else
{
tPWM=micros()-tStart0; // Negative edge: get pulsewidth
}

}

and it works !

for the other entry (that don't have interrupt) i'm using code like that :

void pcInt4InFalling()
{

tCur4 = micros();

tPWM4= tCur4 -tStart4;

}

void pcInt4InRising()
{

tStart4= micros();

}

and it works !!! BUT not correctly on the pin 4 or 5. Sometime i have values that rise up at 19000.

I have not this probleme on the pin 7 ad 11