<fcd>

  <build>
    <programmer exe="$(appdir)compilers\avr\batchfiles\avrc_arduinoA.bat" params="atmega32u4 avr109 com7 57600 &quot;$(outdir)$(target).hex&quot;" UsesComm="1" />
  </build>

  <device file="Arduino Micro"
          name="ATMEGA32U4"
          namealt="m32u4"
          product="AVR"
          family="ATMEGA"
          bits="8" >

	<comminfo 
	devdesc="Arduino Micro"
	pid="8037"
	vid="2341"
	usb_boot="1"
	bootpid="0037"
	bootvid="2341"/>

    <clock max_speed="16000000"
           master_divider="1"
           fixed="16000000" />

    <memory>
      <flash bytes="32768" />
      <ram bytes="2560" />
    </memory>

    <configuration address="0x0000"
                   mult="1" >
      <format>
      </format>

      <setting>
      </setting>

    </configuration>

    <pins sides="4" smd="1" >
        <pin name="(Digital 7) PE6" port="4" bit="6" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
        <pin name="(SS/RxLed) PB0" port="1" bit="0" />
        <pin name="(SCLK) PB1" port="1" bit="1" />
        <pin name="(MOSI) PB2" port="1" bit="2" />
        <pin name="(MISO) PB3" port="1" bit="3" />
        <pin name="(Digital 11/ I/O11/An11/Pwm) PB7" port="1" bit="7" />
        <pin name="/RESET" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
        <pin name="(SCL/Digital 3) PD0" port="3" bit="0" />
        <pin name="(SDA/Digital 2) PD1" port="3" bit="1" />
        <pin name="(RX/Digital 0) PD2" port="3" bit="2" />
        <pin name="(TX/Digital 1) PD3" port="3" bit="3" />
        <pin name="(TxLed) PD5" port="3" bit="5" />
        <pin name="" />
        <pin name="" />
        <pin name="PD4 (Digital 4/An6/An6/Adc8)" port="3" bit="4" />
        <pin name="PD6 (Digital 12/ I/O12/An11 Adc9)" port="3" bit="6" />
        <pin name="PD7 (Digital 6/Pwm//An7/Adc10)" port="3" bit="7" />
        <pin name="PB4 (Digital 8/An8/ I/O8/Adc11)" port="1" bit="4" />
        <pin name="PB5 (Digital 9/Pwm/An9/ I/O9/Adc12)" port="1" bit="5" />
        <pin name="PB6 (Digital 10/Pwm/An10/ I/O10/Adc13)" port="1" bit="6" />
        <pin name="PC6 (Digital 5/Pwm)" port="2" bit="6" />
        <pin name="PC7 (Digital 13/Pwm/Led)" port="2" bit="7" />
        <pin name="PE2 (HWB)" port="4" bit="2" />
        <pin name="" />
        <pin name="" />
        <pin name="PF7 (An0/Adc7)" port="5" bit="7" Adc="7" />
        <pin name="PF6 (An1/Adc6)" port="5" bit="6" Adc="6" />
        <pin name="PF5 (An2/Adc5)" port="5" bit="5" Adc="5" />
        <pin name="PF4 (An3/Adc4)" port="5" bit="4" Adc="4" />
        <pin name="PF1 (An4/Adc1)" port="5" bit="1" Adc="1" />
        <pin name="PF0 (An5/Adc0)" port="5" bit="0" Adc="0" />
        <pin name="" />
        <pin name="" />
        <pin name="" />
    </pins>

    <Adc type="3" 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="1024" />

    <spi>
      <miso port="1" pin="3" />
      <mosi port="1" pin="2" />
      <clk port="1" pin="1" />
      <ss port="1" pin="0" />
    </spi>

    <uart>
      <tx port="3" pin="3" />
      <rx port="3" pin="2" />
    </uart>

    <i2c master="1" >
      <sda port="3" pin="1" />
      <scl port="3" pin="0" />
    </i2c>

    <pwm type="1" >
      <timer>
        <option name="timer0" count="2" />
        <option name="timer1" count="3" />
        <option name="timer2" count="0" />
        <option name="timer3" count="1" />
        <option name="timer4" count="3" />
        <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="7" />
      <out port="3" pin="7" />
      <out port="1" pin="5" />
      <out port="1" pin="6" />
      <out port="3" pin="6"/>
      <out port="2" pin="6" />
      <out port="2" pin="7" />
      <out port="3" pin="4" />
    </pwm>

    <usb type="1" />

    <interrupts>

      <interrupt
          ident="TMR0"
          type="timer8"
          name="Timer 0"
          hAndler='#ifndef MX_TIMER0OVF_HAnDLER\n#define MX_TIMER0OVF_HAnDLER\nISR(TIMER0_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="TMR1"
          type="timer16"
          name="Timer 1"
          hAndler='#ifndef MX_TIMER1OVF_HAnDLER\n#define MX_TIMER1OVF_HAnDLER\nISR(TIMER1_OVF_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <TIMER1 OVF> interrupt has previously been enabLed, so the macro <%n> may never get calLed.\n#endif\n'
          enable="TIMSK1 |= (1 << TOIE1);\n"
          disable="TIMSK1 &= ~(1 << TOIE1);\n" >
        <timer overflow="65536" extrAnge="0" />
        <options>
          <prescale name="Prescaler Rate">
            <entry name="no clock" value ="TCCR1B &= 0xf8;\n" />
            <entry name="1:1" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x01;\n" />
            <entry name="1:8" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x02;\n" />
            <entry name="1:64" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x03;\n" />
            <entry name="1:256" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x04;\n" />
            <entry name="1:1024" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x05;\n" />
            <entry name="T0 pin, -ve edge" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x06;\n" />
            <entry name="T0 pin, +ve edge" value ="TCCR1B &= 0xf8;\nTCCR1B |= 0x07;\n" />
          </prescale>
        </options>
      </interrupt>

      <interrupt
          ident="TMR3"
          type="timer16"
          name="Timer 3"
          hAndler='#ifndef MX_TIMER3OVF_HAnDLER\n#define MX_TIMER3OVF_HAnDLER\nISR(TIMER3_OVF_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <TIMER3 OVF> interrupt has previously been enabLed, so the macro <%n> may never get calLed.\n#endif\n'
          enable="TIMSK3 |= (1 << TOIE3);\n"
          disable="TIMSK3 &= ~(1 << TOIE3);\n" >
        <timer overflow="65536" extrAnge="0" />
        <options>
          <prescale name="Prescaler Rate">
            <entry name="no clock" value ="TCCR3B &= 0xf8;\n" />
            <entry name="1:1" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x01;\n" />
            <entry name="1:8" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x02;\n" />
            <entry name="1:64" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x03;\n" />
            <entry name="1:256" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x04;\n" />
            <entry name="1:1024" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x05;\n" />
            <entry name="T0 pin, -ve edge" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x06;\n" />
            <entry name="T0 pin, +ve edge" value ="TCCR3B &= 0xf8;\nTCCR3B |= 0x07;\n" />
          </prescale>
        </options>
      </interrupt>

        <interrupt ident='IOC0' 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 &lt;PORTB Change&gt; interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.\n#endif\n' enable='PCMSK0 = %pB0h;\nPCICR |= (1 &lt;&lt; PCIE0);\n' disable='PCICR &amp;= ~(1 &lt;&lt; PCIE0);\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="EIMSK |= (1 << INT0);\n"
          disable="EIMSK &= ~(1 << INT0);\n" >
        <ioc config="3">
          <rising port="3" mask="1" />
          <falling port="3" mask="1" />
        </ioc>
        <options>
          <edge name="Interrupt Edge Select">
            <entry name="Rising edge of INT" value="EICRA |= (1 << ISC01) | (1 << ISC00);\n" />
            <entry name="Falling edge of INT" value="EICRA |= (1 << ISC01);\nEICRA &= ~(1 << ISC00);\n" />
          </edge>
        </options>
      </interrupt>

      <interrupt
          ident="INT1"
          type="pin"
          name="INT1 Input"
          hAndler="#ifndef MX_INT1_HAnDLER\n#define MX_INT1_HAnDLER\nISR(INT1_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <INT1 Input> interrupt has previously been enabLed, so the macro <%n> may never get calLed.\n#endif\n"
          enable="EIMSK |= (1 << INT1);\n"
          disable="EIMSK &= ~(1 << INT1);\n" >
        <ioc config="3">
          <rising port="3" mask="2" />
          <falling port="3" mask="2" />
        </ioc>
        <options>
          <edge name="Interrupt Edge Select">
            <entry name="Rising edge of INT" value="EICRA |= (1 << ISC11) | (1 << ISC10);\n" />
            <entry name="Falling edge of INT" value="EICRA |= (1 << ISC11);\nEICRA &= ~(1 << ISC10);\n" />
          </edge>
        </options>
      </interrupt>

      <interrupt
          ident="INT2"
          type="pin"
          name="INT2 Input"
          hAndler="#ifndef MX_INT2_HAnDLER\n#define MX_INT2_HAnDLER\nISR(INT2_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <INT2 Input> interrupt has previously been enabLed, so the macro <%n> may never get calLed.\n#endif\n"
          enable="EIMSK |= (1 << INT2);\n"
          disable="EIMSK &= ~(1 << INT2);\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="EICRA |= (1 << ISC21) | (1 << ISC20);\n" />
            <entry name="Falling edge of INT" value="EICRA |= (1 << ISC21);\nEICRA &= ~(1 << ISC20);\n" />
          </edge>
        </options>
      </interrupt>

      <interrupt
          ident="INT3"
          type="pin"
          name="INT3 Input"
          hAndler="#ifndef MX_INT3_HAnDLER\n#define MX_INT3_HAnDLER\nISR(INT3_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <INT3 Input> interrupt has previously been enabLed, so the macro <%n> may never get calLed.\n#endif\n"
          enable="EIMSK |= (1 << INT3);\n"
          disable="EIMSK &= ~(1 << INT3);\n" >
        <ioc config="3">
          <rising port="3" mask="8" />
          <falling port="3" mask="8" />
        </ioc>
        <options>
          <edge name="Interrupt Edge Select">
            <entry name="Rising edge of INT" value="EICRA |= (1 << ISC31) | (1 << ISC30);\n" />
            <entry name="Falling edge of INT" value="EICRA |= (1 << ISC31);\nEICRA &= ~(1 << ISC30);\n" />
          </edge>
        </options>
      </interrupt>

      <interrupt
          ident="INT6"
          type="pin"
          name="INT6 Input"
          hAndler="#ifndef MX_INT6_HAnDLER\n#define MX_INT6_HAnDLER\nISR(INT6_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The <INT6 Input> interrupt has previously been enabLed, so the macro <%n> may never get calLed.\n#endif\n"
          enable="EIMSK |= (1 << INT6);\n"
          disable="EIMSK &= ~(1 << INT6);\n" >
        <ioc config="3">
          <rising port="4" mask="64" />
          <falling port="4" mask="64" />
        </ioc>
        <options>
          <edge name="Interrupt Edge Select">
            <entry name="Rising edge of INT" value="EICRB |= (1 << ISC61) | (1 << ISC60);\n" />
            <entry name="Falling edge of INT" value="EICRB |= (1 << ISC61);\nEICRB &= ~(1 << ISC60);\n" />
          </edge>
        </options>
      </interrupt>

      <interrupt
          ident="RXINT1"
          type="comms"
          name="UART1 RX"
          hAndler="#ifndef MX_UART1_RX_HAnDLER\n#define MX_UART1_RX_HAnDLER\nISR(USART1_RX_vect)\n{\n\tFCM_%n();\n}\n#else\n#warning The &lt;UART1 RX&gt; interrupt has previously been enabLed, so the macro &lt;%n&gt; may never get calLed.\n#endif\n"
          enable="UCSR0B |= (1 &lt;&lt; RXCIE0);\n"
          disable="UCSR0B &amp;=  ~(1 &lt;&lt; RXCIE0);\n" >
      </interrupt>


    </interrupts>

  </device>

  <inline>

    <defines code="#define MX_UART_ID\n#define MX_UART_UCSRC\n\n#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\tUSBCON = 0;\n" />
      <end code="\tmainendloop: goto mainendloop;\n}\n\n" />
      <init code="\tMCUCR=0x00;\n\tMCUSR=0x00;\n\twdt_disable();\n" />
    </main>

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

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

  </inline>

  <flowkit2>
    <analog>
      <map from='AN0' port="5" pin="7" />
      <map from='AN1' port="5" pin="6" />
      <map from='AN2' port="5" pin="5" />
      <map from='AN3' port="5" pin="4" />
      <map from='AN4' port="5" pin="1" />
      <map from='AN5' port="5" pin="0" />
    </analog>
    <digital>
      <map from='D0' port="3" pin="2" />
      <map from='D1' port="3" pin="3" />
      <map from='D2' port="3" pin="1" />
      <map from='D3' port="3" pin="0" />
      <map from='D4' port="3" pin="4" />
      <map from='D5' port="2" pin="6" />
      <map from='D6' port="3" pin="7" />
      <map from='D7' port="4" pin="6" />
      <map from='D8' port="1" pin="4" />
      <map from='D9' port="1" pin="5" />
      <map from='D10' port="1" pin="6" />
      <map from='D11' port="1" pin="7" />
      <map from='D12' port="3" pin="6" />
      <map from='D13' port="2" pin="7" />
    </digital>
  </flowkit2>

  <test>

    <icd>
      <clock port="1" pin="5" />
      <data port="1" pin="4" />
    </icd>

  </test>

</fcd>
