<fcd>

<build>


    <compiler exe="$(appdir)compilers\pic\boostc\boostc_18f.exe" 
	params="-v -t $(chipalt) &quot;$(target).c&quot;" 
	/>

    <linker exe="$(appdir)compilers\pic\boostc\boostlink_picmicro.exe" 
	params="-rb 0x800 -ld &quot;$(appdir)compilers\pic\boostc\Lib&quot; libc_18F.lib rand_18F.lib float_18F.lib &quot;$(target).obj&quot; -t $(chipalt) -d &quot;$(dir)&quot; -p &quot;$(target)&quot;" 
	/>

    <programmer exe="$(appdir)tools\MIACprog\MiacProg.exe" 
	params="-nogui &quot;$(target).hex&quot;"
	/> 

</build>

  <device name="MIAC"
	namealt="PIC18F4455"
        product="PIC"
        family="18F"
        bits="8" >

    <clock max_speed="48000000"
           master_divider="4"
           fixed="48000000" />

    <memory>
      <flash bytes="24576" />
      <ram bytes="2048" />
    </memory>

    <configuration address="0x300000" mult='2' >
      <format>
	<byte default="0x20" />
        <byte default="0x0E" />
        <byte default="0x3E" />
        <byte default="0x1E" />
        <byte default="0x00" />
        <byte default="0x81" />
        <byte default="0x81" />
        <byte default="0x00" />
        <byte default="0x0F" />
        <byte default="0x80" />
        <byte default="0x0F" />
        <byte default="0xA0" />
        <byte default="0x0F" />
        <byte default="0x00" />
     </format>

      <setting>
      </setting>

    </configuration>

    <pins sides="2" smd="0" >
        <pin name="(RB2/INT2) I8" port="1" bit="2" adc="8" />
        <pin name="(RE2) I7" port="4" bit="2" adc="7" />
        <pin name="(RE1) I6" port="4" bit="1" adc="6" />
        <pin name="(RE0) I5" port="4" bit="0" adc="5" />
        <pin name="(RA3) I4" port="0" bit="3" adc="3" />
        <pin name="(RA2) I3" port="0" bit="2" adc="2" />
        <pin name="(RA1) I2" port="0" bit="1" adc="1" />
        <pin name="(RA0) I1" port="0" bit="0" adc="0" />
        <pin name="Q1 (RB4)" port="1" bit="4" />
        <pin name="Q2 (RB5)" port="1" bit="5" />
        <pin name="Q3 (RB6)" port="1" bit="6" />
        <pin name="Q4 (RB7)" port="1" bit="7" />
        <pin name="A (RC2/CCP1)" port="2" bit="2" />
        <pin name="B (RC0)" port="2" bit="0" />
        <pin name="C (RC1/CCP2)" port="2" bit="1" />
        <pin name="D (RC6)" port="2" bit="6" />
    </pins>

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

    <eeprom type="2" bytes="256" />

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

    <uart>
      <tx port="2" pin="6" />
      <rx port="2" pin="7" />
    </uart>

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

    <pwm>
      <prescaler>
        <option name="1" value="1" />
        <option name="4" value="4" />
        <option name="16" value="16" />
      </prescaler>
      <out port="2" pin="2" />
      <out port="2" pin="1" aport="1" apin="3" />
    </pwm>

    <usb type="1" />

    <interrupts >
        <interrupt ident='TMR0' type='timer8' name='TMR0' handler='#ifndef MX_INTHANDLER_intcon_TMR0IF\n#define MX_INTHANDLER_intcon_TMR0IF\nif (ts_bit(intcon, TMR0IF) &amp;&amp; ts_bit(intcon, TMR0IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\t\n\tFCM_%n();\n\tcr_bit(intcon, TMR0IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon, TMR0IE);\n' disable='cr_bit(intcon, TMR0IE);\n' >
            <timer overflow='256' extrange='0' />
            <options >
                <option name='Clock Source Select' >
                    <entry name='Transition on T0CKI pin' clkdiv='0' value='st_bit(t0con, T0CS);\n' />
                    <entry name='Internal clock (CLKO)' clkdiv='4' value='cr_bit(t0con, T0CS);\n' />
                </option>
                <option name='Source Edge Select' >
                    <entry name='high-to-low transition on TMR0 Clock' value='st_bit(t0con, T0SE);\n' />
                    <entry name='low-to-high transition on TMR0 Clock' value='cr_bit(t0con, T0SE);\n' />
                </option>
                <prescale name='Prescaler Rate' >
                    <entry name='1:1' value='t0con = (t0con &amp; 0xF0) | 0x08;\n' />
                    <entry name='1:2' value='t0con = (t0con &amp; 0xF0) | 0x00;\n' />
                    <entry name='1:4' value='t0con = (t0con &amp; 0xF0) | 0x01;\n' />
                    <entry name='1:8' value='t0con = (t0con &amp; 0xF0) | 0x02;\n' />
                    <entry name='1:16' value='t0con = (t0con &amp; 0xF0) | 0x03;\n' />
                    <entry name='1:32' value='t0con = (t0con &amp; 0xF0) | 0x04;\n' />
                    <entry name='1:64' value='t0con = (t0con &amp; 0xF0) | 0x05;\n' />
                    <entry name='1:128' value='t0con = (t0con &amp; 0xF0) | 0x06;\n' />
                    <entry name='1:256' value='t0con = (t0con &amp; 0xF0) | 0x07;\n' />
                </prescale>
            </options>
        </interrupt>
        <interrupt ident='INT0' type='pin' name='INT0 Pin' handler='#ifndef MX_INTHANDLER_intcon_INT0IF\n#define MX_INTHANDLER_intcon_INT0IF\nif (ts_bit(intcon, INT0IF) &amp;&amp; ts_bit(intcon, INT0IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(intcon, INT0IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon, INT0IE);\n' disable='cr_bit(intcon, INT0IE);\n' >
            <ioc config='3' >
                <rising port='1' mask='1' />
                <falling port='1' mask='1' />
            </ioc>
            <options >
                <edge name='Interrupt Edge Select' >
                    <entry name='Rising edge of INT' value='st_bit(intcon2, INTEDG0);\n' />
                    <entry name='Falling edge of INT' value='cr_bit(intcon2, INTEDG0);\n' />
                </edge>
            </options>
        </interrupt>
        <interrupt ident='IOC0' type='multipin' name='IOC PORTB' handler='#ifndef MX_INTHANDLER_intcon_RBIF\n#define MX_INTHANDLER_intcon_RBIF\nchar mxtmp;\nif (ts_bit(intcon, RBIF) &amp;&amp; ts_bit(intcon, RBIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tmxtmp=portb;\n\tcr_bit(intcon, RBIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon, RBIE);\n' disable='cr_bit(intcon, RBIE);\n' >
            <ioc config='4' >
                <rising port='1' mask='0xF0' />
                <falling port='1' mask='0xF0' />
            </ioc>
        </interrupt>
        <interrupt ident='TMR1' type='timer16' name='TMR1' handler='#ifndef MX_INTHANDLER_pir1_TMR1IF\n#define MX_INTHANDLER_pir1_TMR1IF\nif (ts_bit(pir1, TMR1IF) &amp;&amp; ts_bit(pie1, TMR1IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir1, TMR1IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon, PEIE);\nst_bit(pie1, TMR1IE);\n' disable='cr_bit(pie1, TMR1IE);\n' >
            <timer overflow='65536' extrange='0' />
            <options >
                <option name='Clock Source Select' >
                    <entry name='Transition on T1CKI pin' clkdiv='0' value='st_bit(t1con, T1OSCEN);\nst_bit(t1con, TMR1ON);\nst_bit(t1con, TMR1CS);\n' />
                    <entry name='Internal clock (Fosc/4)' clkdiv='4' value='st_bit(t1con, T1OSCEN);\nst_bit(t1con, TMR1ON);\ncr_bit(t1con, TMR1CS);\n' />
                </option>
                <prescale name='Prescaler Rate' >
                    <entry name='1:1' value='t1con = t1con &amp; 0x0F;\n' />
                    <entry name='1:2' value='t1con = (t1con &amp; 0x0F) | 0x10;\n' />
                    <entry name='1:4' value='t1con = (t1con &amp; 0x0F) | 0x20;\n' />
                    <entry name='1:8' value='t1con = (t1con &amp; 0x0F) | 0x30;\n' />
                </prescale>
            </options>
        </interrupt>
        <interrupt ident='INT1' type='pin' name='INT1 Pin' handler='#ifndef MX_INTHANDLER_intcon3_INT1IF\n#define MX_INTHANDLER_intcon3_INT1IF\nif (ts_bit(intcon3, INT1IF) &amp;&amp; ts_bit(intcon3, INT1IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(intcon3, INT1IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon3, INT1IE);\n' disable='cr_bit(intcon3, INT1IE);\n' >
            <ioc config='3' >
                <rising port='1' mask='2' />
                <falling port='1' mask='2' />
            </ioc>
            <options >
                <edge name='Interrupt Edge Select' >
                    <entry name='Rising edge of INT' value='st_bit(intcon2, INTEDG1);\n' />
                    <entry name='Falling edge of INT' value='cr_bit(intcon2, INTEDG1);\n' />
                </edge>
            </options>
        </interrupt>
        <interrupt ident='INT2' type='pin' name='INT2 Pin' handler='#ifndef MX_INTHANDLER_intcon3_INT2IF\n#define MX_INTHANDLER_intcon3_INT2IF\nif (ts_bit(intcon3, INT2IF) &amp;&amp; ts_bit(intcon3, INT2IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(intcon3, INT2IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon3, INT2IE);\n' disable='cr_bit(intcon3, INT2IE);\n' >
            <ioc config='3' >
                <rising port='1' mask='4' />
                <falling port='1' mask='4' />
            </ioc>
            <options >
                <edge name='Interrupt Edge Select' >
                    <entry name='Rising edge of INT' value='st_bit(intcon2, INTEDG2);\n' />
                    <entry name='Falling edge of INT' value='cr_bit(intcon2, INTEDG2);\n' />
                </edge>
            </options>
        </interrupt>
        <interrupt ident='USBINT0' type='comms' name='USB INT' handler='#ifndef MX_INTHANDLER_pir2_USBIF\n#define MX_INTHANDLER_pir2_USBIF\nif (ts_bit(pir2, USBIF) &amp;&amp; ts_bit(pie2, USBIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir2, USBIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon, PEIE);\nst_bit(pie2, USBIE);\n' disable='cr_bit(pie2, USBIE);\n' />
        <interrupt ident='RXINT0' type='comms' name='UART RXINT' handler='#ifndef MX_INTHANDLER_pir1_RCIF\n#define MX_INTHANDLER_pir1_RCIF\nif (ts_bit(pir1, RCIF) &amp;&amp; ts_bit(pie1, RCIE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir1, RCIF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif' enable='st_bit(intcon, PEIE);\nst_bit(pie1, RCIE);\n' disable='cr_bit(pie1, RCIE);\n' />
        <interrupt ident='TMR2' type='timer8' name='TMR2' handler='#ifndef MX_INTHANDLER_pir1_TMR2IF\n#define MX_INTHANDLER_pir1_TMR2IF\nif (ts_bit(pir1, TMR2IF) &amp;&amp; ts_bit(pie1, TMR2IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir1, TMR2IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif' enable='st_bit(intcon, PEIE);\nst_bit(pie1, TMR2IE);\n' disable='cr_bit(pie1, TMR2IE);\n' >
            <timer overflow='256' extrange='0' />
            <options >
                <prescale name='Prescaler Rate' >
                    <entry name='1:1' value='cr_bit(t2con, T2CKPS0);\ncr_bit(t2con, T2CKPS1);\nst_bit(t2con, TMR2ON);\n' />
                    <entry name='1:4' value='st_bit(t2con, T2CKPS0);\ncr_bit(t2con, T2CKPS1);\nst_bit(t2con, TMR2ON);\n' />
                    <entry name='1:16' value='cr_bit(t2con, T2CKPS0);\nst_bit(t2con, T2CKPS1);\nst_bit(t2con, TMR2ON);\n' />
                </prescale>
                <postscale name='Postscaler Rate' >
                    <entry name='1:1' value='t2con = t2con &amp; 0x07;\n' />
                    <entry name='1:2' value='t2con = (t2con &amp; 0x07) | 0x08;\n' />
                    <entry name='1:3' value='t2con = (t2con &amp; 0x07) | 0x10;\n' />
                    <entry name='1:4' value='t2con = (t2con &amp; 0x07) | 0x18;\n' />
                    <entry name='1:5' value='t2con = (t2con &amp; 0x07) | 0x20;\n' />
                    <entry name='1:6' value='t2con = (t2con &amp; 0x07) | 0x28;\n' />
                    <entry name='1:7' value='t2con = (t2con &amp; 0x07) | 0x30;\n' />
                    <entry name='1:8' value='t2con = (t2con &amp; 0x07) | 0x38;\n' />
                    <entry name='1:9' value='t2con = (t2con &amp; 0x07) | 0x40;\n' />
                    <entry name='1:10' value='t2con = (t2con &amp; 0x07) | 0x48;\n' />
                    <entry name='1:11' value='t2con = (t2con &amp; 0x07) | 0x50;\n' />
                    <entry name='1:12' value='t2con = (t2con &amp; 0x07) | 0x58;\n' />
                    <entry name='1:13' value='t2con = (t2con &amp; 0x07) | 0x60;\n' />
                    <entry name='1:14' value='t2con = (t2con &amp; 0x07) | 0x68;\n' />
                    <entry name='1:15' value='t2con = (t2con &amp; 0x07) | 0x70;\n' />
                    <entry name='1:16' value='t2con = (t2con &amp; 0x07) | 0x78;\n' />
                </postscale>
                <rollover name='Rollover Value' >
                    <entry name='256' min='1' max='256' value='pr2=%d-1;\n' />
                </rollover>
            </options>
        </interrupt>
        <interrupt ident='TMR3' type='timer16' name='TMR3' handler='#ifndef MX_INTHANDLER_pir2_TMR3IF\n#define MX_INTHANDLER_pir2_TMR3IF\nif (ts_bit(pir2, TMR3IF) &amp;&amp; ts_bit(pie2, TMR3IE))\n{\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 1;\n\t#endif\n\tFCM_%n();\n\tcr_bit(pir2, TMR3IF);\n\t#ifdef USE_FLOWCODE_ICD\n\t\textern char ICD_Interrupt_Enable = 0;\n\t#endif\t\n}\n#else\n#warning &quot;This interrupt has previously been enabled, so the macro &lt;%n&gt; may never get called.&quot;\n#endif\n' enable='st_bit(intcon, PEIE);\nst_bit(pie2, TMR3IE);\n' disable='cr_bit(pie2, TMR3IE);\n' >
            <timer overflow='65536' extrange='0' />
            <options >
                <option name='Clock Source Select' >
                    <entry name='Transition on T3CKI pin' clkdiv='0' value='st_bit(t3con, TMR3ON);\nst_bit(t3con, TMR3CS);\n' />
                    <entry name='Internal clock (Fosc/4)' clkdiv='4' value='st_bit(t3con, TMR3ON);\ncr_bit(t3con, TMR3CS);\n' />
                </option>
                <prescale name='Prescaler Rate' >
                    <entry name='1:1' value='t3con = t3con &amp; 0x0F;\n' />
                    <entry name='1:2' value='t3con = (t3con &amp; 0x0F) | 0x10;\n' />
                    <entry name='1:4' value='t3con = (t3con &amp; 0x0F) | 0x20;\n' />
                    <entry name='1:8' value='t3con = (t3con &amp; 0x0F) | 0x30;\n' />
                </prescale>
            </options>
        </interrupt>
    </interrupts>

  </device>

  <inline>

    <defines code="#define MX_MIAC\n\n" />
 
    <config>
	<start code="" />
        <body code="" />
	<end code="" />
    </config>
	
    <directives code="#include <system.h>
\n#pragma DATA 0x300000, 0x20\n#pragma DATA 0x300001, 0xe\n#pragma DATA 0x300002, 0x3e\n#pragma DATA 0x300003, 0x1e\n#pragma DATA 0x300004, 0x0\n#pragma DATA 0x300005, 0x81\n#pragma DATA 0x300006, 0x81\n#pragma DATA 0x300007, 0x0\n#pragma DATA 0x300008, 0xf\n#pragma DATA 0x300009, 0x80\n#pragma DATA 0x30000a, 0xf\n#pragma DATA 0x30000b, 0xa0\n#pragma DATA 0x30000c, 0xf\n#pragma DATA 0x30000d, 0x0\n\n" />

    <main>
      <start code="void main()\n{\n" />
      <end code="\tmainendloop: goto mainendloop;\n}\n\n" />
      <init code="\tadcon0 = 0x3D;\n\tadcon1 = 0x0F;\n\tucfg = 0x08;\n\tcr_bit(pie2, USBIE);\n\n\t#ifdef MX_MIAC_SYSTEM\n\tMIAC_System_Setup();\n\t#endif\n" />
    </main>

    <interrupt>
      <enable code="st_bit(intcon, GIE);\n" />
      <start code="void MX_INTERRUPT_MACRO(void)\n{\n" />
      <end code="}\n\n" />
      <init code="\n\n" />
    </interrupt>


  </inline>

  <test>

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

  </test>

</fcd>
