/*#include "suryaa.h"
#include <avr/interrupt.h>

void setup()
{
  Serial.begin(9600);
  pin_configure();
  sei();
 // i2c_start();
}

void loop()
{
  volatile long i;
  i2c_start();
}*/


/*#include <avr/interrupt.h>

void pin_configure(void);
void out_f(char);
void set_timer0_5_microsec_delay(void);
void i2c_start(void);

void pin_configure(void)
{
  volatile char* dirf = (volatile char*)0x30;
  volatile char* outf = (volatile char*)0x31;
  *dirf = 0xFF;
  *outf = 0xFF;
}

void out_f(char x)
{
  volatile char* outf = (volatile char*)0x31;
  *outf = x;
}

void set_timer0_5_microsec_delay(void)
{
  Serial.println("Timer started");
  volatile char* tccr0a = (volatile char*)0x44;
  volatile char* tccr0b = (volatile char*)0x45;
  volatile char* tcnt0 = (volatile char*)0x46;
  volatile char* ocr0 = (volatile char*)0x47;
  volatile char* timsk0 = (volatile char*)0x6E;
  volatile char* tifr0 = (volatile char*)0x35;

  *tccr0a = 0x02; // Set timer in CTC mode
  *tccr0b = 0x01; // Set no prescaling
  *tcnt0 = 0x00; // Set the count register value to 0 initially
  *ocr0 = 0x4F;  // Load 79 to delay 5us
  *timsk0 = 0x02; // Enable the OC0A interrupt

  // Wait for the OCF0A flag to be set
  while (!(*tifr0 & (1 << 1)));

  // Clear the OCF0A flag after it is set
  *tifr0 |= (1 << 1);
}

ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
  // Temporarily disable the OC0A interrupt
  volatile char* timsk0 = (volatile char*)0x6E;
  volatile char* tifr0 = (volatile char*)0x35;
  *timsk0 &= ~(1 << 1); // Clear the OCIE0A bit to disable the interrupt

  // Critical section
  volatile char* tccr0b = (volatile char*)0x45;
  volatile char* tcnt0 = (volatile char*)0x46;
  *tccr0b = 0x00; // Disable the timer by setting no prescaling
  *tcnt0 = 0x00;  // Set the count register value to 0

  // Clear the OCF0A flag
  *tifr0 |= (1 << 1);

  Serial.println("Timer off");

  // Re-enable the OC0A interrupt
  *timsk0 |= (1 << 1); // Set the OCIE0A bit to re-enable the interrupt
}

void i2c_start(void)
{
  set_timer0_5_microsec_delay();
  out_f(0x02);
  set_timer0_5_microsec_delay();
  out_f(0x01);
}

void setup()
{
  Serial.begin(9600);
  pin_configure();
  sei();
  // i2c_start();
}

void loop()
{
  volatile long i;
  i2c_start();
  for (i = 0; i < 100000; i++);
}*/



void pin_configure(void);
void out_f(char);
void set_timer0_5_microsec_delay(void);
void i2c_start(void);

void pin_configure(void)
{
  volatile char* dirf = (volatile char*)0x30;
  volatile char* outf = (volatile char*)0x31;
  *dirf = 0xFF;
  *outf = 0xFF;
}

void out_f(char x)
{
  volatile char* outf = (volatile char*)0x31;
  *outf = x;
}

void set_timer0_5_microsec_delay(void)
{
  volatile char* tccr0a = (volatile char*)0x44;
  volatile char* tccr0b = (volatile char*)0x45;
  volatile char* tcnt0 = (volatile char*)0x46;
  volatile char* ocr0 = (volatile char*)0x47;
  volatile char* timsk0 = (volatile char*)0x6E;
  volatile char* tifr0 = (volatile char*)0x35;

  Serial.println("Timer started");

  // Clear the OCF0A flag before starting the timer
  *tifr0 |= (1 << OCF0A);

  *tccr0a = 0x02; // Set timer in CTC mode
  *tccr0b = 0x01; // Set no prescaling
  *tcnt0 = 0x00; // Set the count register value to 0 initially
  *ocr0 = 0x4F;  // Load 79 to delay 5us
  *timsk0 = 0x02; // Enable the OC0A interrupt
}

ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
  cli();
  volatile char* tccr0b = (volatile char*)0x45;
  volatile char* tcnt0 = (volatile char*)0x46;
  volatile char* timsk0 = (volatile char*)0x6E;
  volatile char* tifr0 = (volatile char*)0x35;


  // Disable the timer
  *tccr0b = 0x00; // Set no prescaling
  *tcnt0 = 0x00;  // Set the count register value to 0 initially
  *timsk0 = 0x00; // Disable the OC0A interrupt
  *tifr0 |=(1<<1);

  Serial.println("Timer off");
}

void i2c_start(void)
{
  set_timer0_5_microsec_delay();
  out_f(0x02);
  _delay_us(10); // Small delay to observe changes
  set_timer0_5_microsec_delay();
  out_f(0x01);
  _delay_us(10); // Small delay to observe changes
}

void setup()
{
  Serial.begin(9600);
  pin_configure();
  sei();
  // i2c_start();
}

void loop()
{
  volatile long i;
  i2c_start();
  for (i = 0; i < 1000000; i++); // Delay to observe changes
}