Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- loading bar 125 ms, resetiraj kada se napuni, pritiskom na int1
- zaustavi/pokreni
- */
- #define F_CPU 7372800UL
- #include <avr/io.h>
- #include <avr/interrupt.h>
- #include <util/delay.h>
- uint8_t state = 0x00;
- ISR(INT1_vect){
- state ^= 0x01;
- _delay_ms(50);
- GIFR = (1 << INTF1);
- }
- void blink(){
- if(PORTA == 0x00){
- PORTA = 0xff;
- _delay_ms(125);
- }
- PORTA = PORTA << 1;
- }
- int main(void)
- {
- DDRA = 0xff;
- PORTA = 0xff;
- MCUCR = (1 << ISC11) | (1 << ISC10);
- GICR = (1 << INT1);
- sei();
- while (1)
- {
- _delay_ms(125); //loool, compiler error
- if(state == 0x00){
- blink();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement