You are on page 1of 2

#include <mega16.

h>

#include <alcd.h>

#include <stdio.h>

#include <delay.h>

int counter = 0;

char buff [33];

interrupt [EXT_INT0] void ext_int0_isr(void){

if (PIND.3 == 0) counter++;

else counter--;

void main(void){

DDRD = 0x00;

PORTD = 0x0C;

GICR |= 0x40;

MCUCR = 0x40;

MCUCSR = 0x03;

GIFR = 0x00;

lcd_init(16);

#asm("sei")

while (1){

sprintf (buff,"cnt = %d", counter);


lcd_gotoxy(0,0);

lcd_puts(buff);

delay_ms(100);

You might also like