Timer

Is there a way to create a timer without using any pin or Arduino?

http://en.wikipedia.org/wiki/555_timer_IC

i was not thinking at that timer

i have a timer function

      TCCR2A &= ~((1<<WGM21) | (1<<WGM20));
      TCCR2B &= ~(1<<WGM22);
      TCCR2B = (1<<CS22)|(1<<CS21);      
      ASSR |=(0<<AS2);
      // Use normal mode  
      TCCR2A =0;    
      //Timer2 Overflow Interrupt Enable  
      TIMSK2 |= (0<<OCIE2A);
      TCNT2=0x06;  // counting starts from 6;  
      TIMSK2 = (1<<TOIE2);    
      SREG|=1<<SREG_I;
// Timer2 interrupt routine - 1/(160000000/256/(256-6)) = 4ms interval
ISR(TIMER2_OVF_vect) 
{  
      TCNT2  = 6;
      UpdateKey();
}

that i use to update a keypad buttons status
The problem is that i need to use pwm on pin 3 to control my lcd back light,but because of this timer i can’t(the light is off)

so i need something like a new thread to update the buttons staus and use pin 3 as pwm

what i have to change to use timer 1 instead of timer 2 in that function because 0n pins 9 and 10 i use digitalWrite, so they are not affected by the timer?

Do you really need to programmaticly change the backlight intensity? Why not just connect a potentiometer between +V, ground, and the backlight, and twist a knob?

I don't need to programmatically change the back light intensity, i ca use a pot, but this is a good opportunity for me to learn how to use timers

You can avoid hw timers altogether and use the millis() function, like this:

int t;

void setup() {
  t = millis();
}

void loop() {
  if (millis() - t > 1000) {
    t = millis();
    // do action
  }
}

action gets executed every 1000ms.