<fcd>

  <device name="ATTINY13"
          namealt="t13"
          product="AVR"
          family="ATTINY"
          bits="8" >

    <clock max_speed="20000000"
           master_divider="1"
           default="8000000" />

    <memory>
      <flash bytes="1024" />
      <ram bytes="64" />
    </memory>
    <configuration address="0x0000"
                   mult="1"
				   progonly="1" >
      <format>
        <word address='0' default='0x12345' value='0x6789A' />
      </format>

      <settings>
        <setting crud='abc' />
      </settings>

    </configuration>

    <pins sides="2" smd="0" >
        <pin name="(PCINT5/RESET/ADC0) PB5" port="1" bit="5" adc="0" />
        <pin name="(PCINT3/CLKI/ADC3) PB3" port="1" bit="3" adc="3" />
        <pin name="(PCINT4/ADC2) PB4" port="1" bit="4" adc="2" />
        <pin name="GND" />
        <pin name="PB0 (MOSI/AIN0/OC0A/PCINT0)" port="1" bit="0" />
        <pin name="PB1 (MISO/AIN1/OC0B/INT0/PCINT1)" port="1" bit="1" />
        <pin name="PB2 (SCK/ADC1/T0/PCINT2)" port="1" bit="2" adc="1" />
        <pin name="VCC" />
    </pins>

    <adc type="5" bits="10" >
      <speed>
        <option name="Fosc / 2" value="1" />
        <option name="Fosc / 4" value="2" />
        <option name="Fosc / 8" value="3" />
        <option name="Fosc / 16" value="4" />
        <option name="Fosc / 32" value="5" />
        <option name="Fosc / 64" value="6" />
        <option name="Fosc / 128" value="7" />
      </speed>
    </adc>

    <eeprom type="1" bytes="64" />

    <pwm type="1" >
      <timer>
        <option name="timer0" count="2" />
        <option name="timer1" count="0" />
        <option name="timer2" count="0" />
        <option name="timer3" count="0" />
        <option name="timer4" count="0" />
        <option name="timer5" count="0" />
      </timer>
      <prescaler>
        <option name="1" value="1" />
        <option name="8" value="8" />
        <option name="64" value="64" />
        <option name="256" value="256" />
        <option name="1024" value="1024" />
      </prescaler>
      <out port="1" pin="0" />
      <out port="1" pin="1" />
    </pwm>

    <interrupts>

      <interrupt
          ident="TMR0"
          type="timer8"
          name="Timer 0"
          handler='#ifndef MX_TIMER0OVF_HANDLER\n#define MX_TIMER0OVF_HANDLER\nISR(TIM0_OVF_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <TIMER0 OVF> interrupt has previously been enabled, so the macro <%n> may never get called.\n#endif\n'
          enable="TIMSK0 |= (1 << TOIE0);\n"
          disable="TIMSK0 &= ~(1 << TOIE0);\n" >
        <timer overflow="256" extrange="0" />
        <options>
          <prescale name="Prescaler Rate">
            <entry name="no clock" value ="TCCR0B &= 0xf8;\n" />
            <entry name="1:1" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x01;\n" />
            <entry name="1:8" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x02;\n" />
            <entry name="1:64" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x03;\n" />
            <entry name="1:256" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x04;\n" />
            <entry name="1:1024" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x05;\n" />
            <entry name="T0 pin, -ve edge" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x06;\n" />
            <entry name="T0 pin, +ve edge" value ="TCCR0B &= 0xf8;\nTCCR0B |= 0x07;\n" />
          </prescale>
        </options>
      </interrupt>

      <interrupt
          ident="IOCB0"
          type="multipin"
          name="IOC PORT B"
          handler="#ifndef MX_PCINT0_HANDLER\n#define MX_PCINT0_HANDLER\nISR(PCINT0_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <PORTB Change> interrupt has previously been enabled, so the macro <%n> may never get called.\n#endif\n"
          enable="PCMSK = %pB*v;\nGIMSK |= (1 << PCIE);\n"
          disable="GIMSK &= ~(1 << PCIE);\n" >
        <ioc config="0x0C">
          <rising port="1" mask="0xFF" />
          <falling port="1" mask="0xFF" />
        </ioc>
      </interrupt>

      <interrupt
          ident="INT0"
          type="pin"
          name="INT0 Input"
          handler="#ifndef MX_INT0_HANDLER\n#define MX_INT0_HANDLER\nISR(INT0_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <INT0 Input> interrupt has previously been enabled, so the macro <%n> may never get called.\n#endif\n"
          enable="GIMSK |= (1 << INT0);\n"
          disable="GIMSK &= ~(1 << INT0);\n" >
        <ioc config="3">
          <rising port="3" mask="4" />
          <falling port="3" mask="4" />
        </ioc>
        <options>
          <edge name="Interrupt Edge Select">
            <entry name="Rising edge of INT" value="MCUCR |= (1 << ISC01) | (1 << ISC00);\n" />
            <entry name="Falling edge of INT" value="MCUCR |= (1 << ISC01);\nMCUCR &= ~(1 << ISC00);\n" />
          </edge>
        </options>
      </interrupt>


    </interrupts>

  </device>

  <inline>

    <defines code="#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n#include &lt;math.h&gt;\n#include &lt;avr\io.h&gt;\n#include &lt;avr\interrupt.h&gt;\n#include &lt;avr\eeprom.h&gt;\n#include &lt;avr\wdt.h&gt;\n\n" />
    <directives code="" />

    <main>
      <start code="int main()\n{\n" />
      <end code="\tmainendloop: goto mainendloop;\n}\n\n" />
      <init code="\tMCUSR=0x00;\n\twdt_disable();\n" />
    </main>

    <interrupt>
      <enable code="sei();\n" />
      <start code="" />
      <end code="" />
      <init code="\t" />
    </interrupt>

    <config>
      <start code='//Configuration Start\n' /> 
      <body code='' /> 
      <end code='//Configuration End\n\n' />
    </config>

  </inline>

  <test>

    <icd>
      <clock port="1" pin="6" />
      <data port="1" pin="7" />
    </icd>

  </test>

</fcd>
