port - pin assignment question

I'm trying to adapt the following code to use pin 9 instead of pin 8 (see setup()) but so far I have come up short. is this easy? impossible?
I tried to include the entire sketch, but it was too long...
thanks!

void setup()
{
  Serial.begin(57600);

  DDRB = 0x2F;   
  DDRB  &= ~(1<<DDB0); 
  PORTB &= ~(1<<PORTB0);
  DDRD  |=  B11000000;
  TCCR1A = B00000000;
  TCCR1B = ( _BV(ICNC1) | _BV(CS11) | _BV(CS10) );
  SET_INPUT_CAPTURE_RISING_EDGE();
  TIMSK1 = ( _BV(ICIE1) | _BV(TOIE1) );

  Serial.println("[OS V3 Sensor Capture/Decode]");
  WEATHER_RESET();
}

void loop() 
{
  // weather packet ready to decode
  if(weather_rx_state == RX_STATE_PACKET_RECEIVED) 
  {
    //  Shift bits right 1
    for (int j = packet_bit_pointer/8+1; j > 0; j--)
    {
      packet[j] >>= 1;
      if ((packet[j - 1] & 0x01) == 1)
        packet[j] |= (1 << (7));
    }
    packet[0] >>= 1;

    switch(packet[0])
    {
      case 0x5F: DecodeTemp(); break;
      case 0x5B: DecodeUV(); break;
      case 0x58: DecodeWind(); break;
      case 0x54: DecodeRain(); break;
    }

    WEATHER_RESET();
  }
} 

// THGN801 Temperature / Humidity Sensor Data Format.
// Sample Data:
// 01011111000101000010100001000000100011001000000000001100101000001011010001111001
// --------------------------------4444333322221111SSSS66665555--------CCCC--------
// 
// 11112222.33334444 = Temperature
// 55556666 = Humidity %
// CCCC = CRC
void DecodeTemp()
{
    // check the packet CRC
    if (!ValidCRC(16))
    {
        Serial.println("Temp: CRC Error!");
        return;
    }
    
    // grab the temperature
    int whole =  (GetNibble(11) * 10) + GetNibble(10);
    int decimal = (GetNibble(9) * 10) + GetNibble(8);
    temprature = (decimal * 0.01) + whole;
    
    if (GetNibble(12) == 1)
        temprature *= -1;
        
    // convert Celsius to Fahrenheit 
    temprature = ((9.0 / 5.0) * temprature) + 32;
        
    // grab the humidity
    humidity = (GetNibble(14) * 10) + GetNibble(13);
    
    Serial.print("Temp: ");
    Serial.print( temprature);
    Serial.print("   Humidity: ");
    Serial.println(humidity);
}
// UVN800 UV Sensor
// Sample Data:
// 010110110001111000101000101100100000000000001000111000000101110001110000
// ------------------------------------11111----------------CCCC-----------
// 
// 1111 = UV
// CCCC = CRC

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

This is the code you have to change in setup(), because the rest of the code is not here, you have to do the rest yourself :).

 DDRB = 0x2F;  
  DDRB  &= ~(1<<DDB1);
  PORTB &= ~(1<<PORTB1);

That was my first instinct also - but I tried exactly what you've suggested, and can't find any other references to the pin, but I get nothing on pin 9.

here is a link to the code: http://www.lostbyte.com/wp-content/uploads/2010/04/osv3_decode.zip

I'm wondering if I need to change the code that immediately follows the lines you've changed also?

Thanks!

That's why we need the whole code! Your sketch is using the ICR (Input capture) interrupt from pin ICP1 which is fix on PB0 (which is pin 8 on Arduino). You cannot change that without completely rewriting your sketch using other hardware features and even then it might not be possible.

If you tell us why you wanna change to pin 9 we might have a solution for the other side of the problem.

I've provided a link to the code in my previous post. I need pin 8 because of a GRPS shield that can only do serial on 0,1 or 7,8...maybe I should just jumper it....

I need pin 8 because of a GRPS shield that can only do serial on 0,1 or 7,8...maybe I should just jumper it....

That would be far simpler.