Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #define F_CPU 1000000UL
  2. #include
  3. #include
  4. //#include
  5. void init_timer0()
  6. {
  7. TCCR0|=(1<<WGM01)|(1<<WGM00)|(1<<COM01)|(1<<CS01);  //PB3
  8. DDRB|=(1<<PB3);
  9. }
  10. void init_timer1()
  11. { TCCR1A = (1 << COM1B1) | (1 << WGM10) ;
  12. TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11) ;
  13. }
  14. void init_timer2()
  15. {
  16. TCCR2|=(1<<WGM20)|(1<<WGM21)|(1<<COM21)|(1<<CS21);  //PD4
  17. DDRD|=(1<<PD7);
  18.  
  19. }
  20. int i=0x80;
  21. void main()
  22. {
  23. //DDRD=0XFF;
  24. //DDRA=0xF0;
  25. //PORTA=0xFF;//pull up resistance//0b11111111
  26. while(1)
  27. {
  28.  
  29. DDRB=0xFF;
  30. init_timer0();
  31. init_timer1();
  32. init_timer2();
  33. OCR0=255;
  34. _delay_ms(1);
  35. OCR1A=0;
  36.  
  37. OCR1B=255;
  38. _delay_ms(1);
  39.  
  40. OCR2=255;
  41. _delay_ms(1);
  42.  
  43. //keypad_read();
  44. //lcd_init();
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement