Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 7372800UL
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- #include "lcd.h"
- int counter = 0;
- ISR(INT0_vect)
- {
- lcd_clrscr();
- lcd_gotoxy(3, 0);
- lcd_puts("20.01.2019.");
- lcd_gotoxy(3, 1);
- lcd_puts("Matej Duvnjak");
- /*Napraviti preko Timera, a ne delaya jer ako koristimo timer onesposobljujemo rad
- mikrokontrolera, s timerom i dalje ga mozemo koristiti*/
- //_delay_ms(15000);
- //lcd_clrscr();
- TCCR0 |= _BV(CS02) | _BV(CS00); //pokreni timer | zelimo sacuvati vrijednosti koje smo defiirali u mainu
- }
- ISR(TIMER0_COMP_vect)
- {
- counter++;
- if(counter == 750)
- {
- lcd_clrscr();
- TCCR0 = _BV(WGM01); //resetriaj timer | pauziramo ga
- counter = 0;
- }
- }
- int main(void)
- {
- DDRD = _BV(4);
- TCCR1A = _BV(COM1B1) | _BV(WGM10);
- TCCR1B = _BV(WGM12) | _BV(CS11);
- OCR1B = 128;
- //TCCR0 = _BV(WGM01) | _BV(CS02) | _BV(CS00);
- TCCR0 = _BV(WGM01);
- OCR0 = 143;
- TIMSK = _BV(OCIE0);
- MCUCR = _BV(ISC00) | _BV(ISC01);
- GICR = _BV(INT0);
- sei();
- lcd_init(LCD_DISP_ON);
- lcd_clrscr();
- while (1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement