daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Apr 19th, 2018 75 in 20 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. volatile uint32_t ul_contador=0;
  2.  
  3. ISR(TIMER0_OVF_vect){
  4.   ul_contador++;
  5.   if(ul_contador>=100){//100
  6.     ul_contador=0;
  7.     PORTB^=(1<<PB5);//PINB |=(1<<PINB5);
  8.     }
  9.   }
  10. //A
  11. void InitTimer0(){
  12.  /* cli();
  13.   TCCR0A|=(1<<0);
  14.   TCCR0B |=(1<<5);//WGM13=1
  15.   TCCR0B |= (1 << CS02) | (1 << CS00);
  16.   TIMSK0 |=(1<<0);//toie=1
  17.   sei();*/
  18.    cli();
  19.   TCCR0A&=~(1<<0);
  20.   TCCR0A |= (1 <<1);
  21.   //TCCR0B |=(1<<5);//WGM13=1
  22.   TCCR0B &=~(1 << 3);
  23.   TCCR0B |=(1 << CS02);
  24.   TCCR0B &=~(1 << CS01);
  25.   TCCR0B &=~(1 << CS00);
  26.   TIMSK0 |=(1<<0);//toie=1
  27.   sei();
  28.   }
  29. int main(void){
  30.   DDRB |=(1<<DDB5);//pin 13 como salida
  31.   InitTimer0();
  32.   while(1){}
  33.   return 0;
  34.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top