#define F_CPU 16000000
#include <avr/io.h>
#include <avr/interrupt.h>
void uart0_init(void);
int Putchar(char message);
int x=0;
int main(void)
{
uart0_init();
while(1)
{
if(x==0)
{
Putchar('.');
}
if(x==1)
{
Putchar('p');
}
}
}
int interrupt(void)
{
EICRA = 0x0F; // Rising Edge detection
EIMSK = 0x03; // Set INT0 & INT1
SREG |= 0x80; // Global Interrupt Enable
while(1)
{
}
}
ISR(INT0_vect)
{
x++;
}
ISR(INT1_vect)
{
x--;
}
void uart0_init(void) {
UCSR0B = 0x00; //disable while setting baud rate
UCSR0A = 0x00;
UCSR0C = 0x06;
UBRR0L = 0x67; //set baud rate lo
UBRR0H = 0x00; //set baud rate hi
UCSR0B = 0x18;
}
int Putchar(char message) {// Putchar "P" cVde
while (((UCSR0A>>UDRE0)&0x01) == 0) ; // UDRE, data register empty
UDR0 = message;
return 0;
}