Advertisement
gabrielaozegovic

nije gotovo - fotosenzor i 7seg

Jan 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #define F_CPU 7372800UL
  2.  
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5. #include <avr/interrupt.h>
  6.  
  7. uint16_t data[] = {0, 0, 0, 0};
  8.  
  9.  
  10. int main(void){
  11.  
  12. DDRD = 0xff;
  13. DDRB = 0xf0;
  14.  
  15. //PORTA = 0xff;
  16. PORTB = 0xff;
  17.  
  18. TCCR1B = _BV(WGM12) | _BV(CS11);
  19. OCR1A = 9216;
  20. TIMSK = _BV(OCIE1A);
  21. sei();
  22.  
  23. ADMUX = _BV(REFS0) | 0;
  24. ADCSRA = _BV(ADEN) | _BV(ADPS2) | _BV(ADPS0);
  25.  
  26. uint16_t values[] = {0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f};
  27.  
  28. while(1){
  29. ADCSRA |= _BV(ADSC);
  30.  
  31. while(!(ADCSRA & _BV(ADIF)));
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement