Decoding RF receiver signals By using the following draft i decode the signals from an RF receiver

#define CH1 2
#define CH2 3
#define CH3 4
#define CH4 5
#define CH5 6
#define CH6 7

int ch1Time, ch2Time, ch3Time, ch4Time, ch5Time, ch6Time = 0;
void channels()
{
  TCNT1 = 0;
  ch1Time = 0; ch2Time = 0; ch3Time = 0; ch4Time = 0; ch5Time = 0; ch6Time = 0;

  while ((PIND &amp; ((1 &lt;&lt; CH1) | (1 &lt;&lt; CH2) | (1 &lt;&lt; CH3) | (1 &lt;&lt; CH4) | (1 &lt;&lt; CH5) | (1 &lt;&lt; CH6))))
  {
    if (PIND &amp; (1 &lt;&lt; CH1))
      ch1Time = TCNT1;

    if (PIND &amp; (1 &lt;&lt; CH2))
      ch2Time = TCNT1;

    if (PIND &amp; (1 &lt;&lt; CH3))
      ch3Time = TCNT1;

    if (PIND &amp; (1 &lt;&lt; CH4))
      ch4Time = TCNT1;

    if (PIND &amp; (1 &lt;&lt; CH5))
      ch5Time = TCNT1;

    if (PIND &amp; (1 &lt;&lt; CH6))
      ch6Time = TCNT1;
  }
}


The issue is that i need also to use the 6 PWM's of the nano board.
So i thought of moving the channels 1-6 to the analog pins like so..

#define CH1 A0
#define CH2 A1
#define CH3 A2
#define CH4 A3
#define CH5 A4
#define CH6 A5


while ((PINC &amp; ((1 &lt;&lt; CH1) | (1 &lt;&lt; CH2) | (1 &lt;&lt; CH3) | (1 &lt;&lt; CH4) | (1 &lt;&lt; CH5) | (1 &lt;&lt; CH6))))
  {
    if (PINC &amp; (1 &lt;&lt; CH1))
      ch1Time = TCNT1;
etc...


but it simply does not work. Any thoughts please?
I see two immediate problems:


The macros A0-A5 are the numbers 14 to 19, not the numbers 0 to 5 - so you're looking at (1 &lt;&lt; 14) for CH1 not (1 &lt;&lt; 0).
The analog pins are port C not port B, so you need to use PINC not PINB.
Your ch?Time variables should be volatile.