void init_port();
void timer();
void setup() {
// put your setup code here, to run once:
init_port();
timer();
volatile long i;
volatile int j=0;
Serial.begin(9600);
while(1)
{
Serial.println(j,DEC);
j++;
for(i=0;i<500000;i++);
}
}
void timer()
{
volatile char *timer2_TCCR2A = 0xB0;
volatile char *timer2_TCCR2B = 0xB1;
volatile short *timer2_TCNT2 = 0xB2;
volatile short *timer2_OCR2A = 0xB3;
volatile char *timer2_TIMSK2 = 0x70;
timer2_TCCR2A = 0;
*timer2_TCCR2B = 0;
timer2_TCNT2 = 0;
*timer2_TCCR2B = 0x0f;
*timer2_OCR2A = 500000;
*timer2_TIMSK2 = 0x02;
}
void init_port()
{
volatile char *portf_dir = (volatile char *)0x30;
*portf_dir = 0x01;
}
ISR(TIMER2_COMPA_vect)
{
volatile char *out = (volatile char *)0x31;
//volatile long i;
*out ^= 0x01;
}
void loop() {
// put your main code here, to run repeatedly:
}