<root>
<document schema='101' license='1,stefan.erni,BAY7TW' title='' description='' target='PIC32.32MZ.32MZ2048EFG100' >
	<config data='!0,0!20,0!40,0!60,0!80,0!a0,0!c0,2!e0,1!100,0!120,31!140,1!160,0!180,1!1a0,0!1c0,0!1e0,0!200,0!220,1!240,0!260,14!280,1!2a0,1!2c0,0!2e0,0!300,0!320,0!340,3!360,0!380,0!3a0,0!3c0,0!3e0,0!400,0!420,0!440,0!460,0!480,0!4a0,0!4c0,0!4e0,0!500,1%0,0%20,0%40,0%60,0%80,0%a0,0%c0,2%e0,1%100,0%120,31%140,1%160,0%180,1%1a0,0%1c0,0%1e0,0%200,0%220,1%240,0%260,14%280,1%2a0,1%2c0,0%2e0,0%300,0%320,0%340,3%360,0%380,0%3a0,0%3c0,0%3e0,0%400,0%420,0%440,0%460,0%480,0%4a0,0%4c0,0%4e0,0%500,1' clkspd='200000000' simspd='1' usewdt='0' constif='0' />
	<plugins >
		<dll_dbg_icd enabled='0' >
			<data name='debug' value='1' />
			<data name='userpins' value='0' />
			<data name='speed' value='0' />
			<data name='usev9' value='0' />
			<data name='breaks' value='8' />
			<data name='stacks' value='8' />
			<data name='clkport' value='1' />
			<data name='clkbit' value='6' />
			<data name='dataport' value='1' />
			<data name='databit' value='7' />
			<data name='ghostype' value='0' />
			<data name='monitor' value='1' />
			<data name='ictloop' value='0' />
			<data name='ictrate' value='20000' />
			<data name='ictmask' value='0' />
			<data name='anlpres' value='19' />
			<data name='digmask1' value='-1' />
			<data name='digmask2' value='-1' />
		</dll_dbg_icd>
		<dll_models enabled='1' />
		<dll_upgrader enabled='1' />
		<dll_webhelp enabled='1' />
	</plugins>
	<supplement use='0' head='// declared static in case exception condition would prevent
// auto variable being created
static enum {
    EXCEP_IRQ = 0,            // interrupt
    EXCEP_AdEL = 4,            // address error exception (load or ifetch)
    EXCEP_AdES,                // address error exception (store)
    EXCEP_IBE,                // bus error (ifetch)
    EXCEP_DBE,                // bus error (load/store)
    EXCEP_Sys,                // syscall
    EXCEP_Bp,                // breakpoint
    EXCEP_RI,                // reserved instruction
    EXCEP_CpU,                // coprocessor unusable
    EXCEP_Overflow,            // arithmetic overflow
    EXCEP_Trap,                // trap (possible divide by zero)
    EXCEP_IS1 = 16,            // implementation specfic 1
    EXCEP_CEU,                // CorExtend Unuseable
    EXCEP_C2E                // coprocessor 2
} _excep_code;

static char * ExcepStr[]={
/*00*/    &quot;0x00 IRQ  Interrupt&quot;,
/*01*/    &quot;0x01 MOD  TLB Modified&quot;,
/*02*/    &quot;0x02 TLBL TLB exception (load or instruction fetch)&quot;,
/*03*/    &quot;0x03 TLBS TLB exception (store)&quot;,
/*04*/    &quot;0x04 AdEL Address err exception (load or ifetch)&quot;,
/*05*/    &quot;0x05 AdES Address err exception (store)&quot;,
/*06*/    &quot;0x06 IBE  Bus error (ifetch)&quot;,
/*07*/    &quot;0x07 DBE  Bus error (load/store)&quot;,
/*08*/    &quot;0x08 Sys  Syscall exception&quot;,
/*09*/    &quot;0x09 Bp   Breakpoint exception&quot;,
/*10*/    &quot;0x0A RI   Reserved Instruction exception&quot;,
/*11*/    &quot;0x0B CpU  Coprocessor Unusable exception&quot;,
/*12*/    &quot;0x0C Ov   Arithmetic Overflow&quot;,
/*13*/    &quot;0x0D Trap Trap (possible divide by zero)&quot;,
/*14*/    &quot;0x0E&quot;,
/*15*/    &quot;0x0F FPE  Floating Point exception&quot;,
/*16*/    &quot;0x10 IS1  implementation specfic 1&quot;,
/*17*/    &quot;0x11 CEU  CorExtend Unuseable&quot;,
/*18*/    &quot;0x12 C2E  coprocessor 2&quot;,
/*19*/    &quot;0x13 TLBRi TLB Read Inhibit&quot;,
/*20*/    &quot;0x14 TLBEi TLB Execute Inhibit&quot;,
};
static unsigned int _epc_code;
static unsigned int _excep_addr;
static unsigned int _excep_vaddr;' body='

// this function overrides the normal _weak_ generic handler
void __attribute__((optimize(&quot;O0&quot;))) _general_exception_handler(void)
{
    asm volatile(&quot;mfc0 %0,$8&quot;  : &quot;=r&quot; (_excep_vaddr));
    asm volatile(&quot;mfc0 %0,$13&quot; : &quot;=r&quot; (_epc_code));
    asm volatile(&quot;mfc0 %0,$14&quot; : &quot;=r&quot; (_excep_addr));

    _excep_code = (_epc_code &amp; 0x0000007C) &gt;&gt; 2;

   TRISB = 0x0000;

    while (1) {
        PORTB = 0x00;
        delay_s(1);
        PORTB = 0x55;
        delay_s(1);
        PORTB = 0xAA;
        delay_s(1);
        PORTB = _excep_code;
        delay_s(1);
        PORTB = _excep_addr;
        delay_s(1);
    }
}

' />
	<debug />
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='c0cc87ee-2fd4-442b-87a9-5c7a807ed7d2' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' iconpath='' />
		<component class_type='root' codename='panel' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Led_is_on' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='irq_port_a' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='decision' title='Decision' disable='1' cmdcolor='3568629' cmdcolor_sec='3568629' exp='Led_is_on = 0' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' disable='1' cmdcolor='1975743' cmdcolor_sec='1975743' component='led_3' macro='TurnOff' />
								<command class_type='calculation' title='Calculation' disable='1' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='Led_is_on = 1' />
								</command>
							</flowline>
							<flowline >
								<command class_type='call' title='Call Component Macro' disable='1' cmdcolor='1975743' cmdcolor_sec='1975743' component='led_3' macro='TurnOn' />
								<command class_type='calculation' title='Calculation' disable='1' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='Led_is_on = 0' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='irq_timer1' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='decision' title='Decision' disable='1' cmdcolor='3568629' cmdcolor_sec='3568629' exp='Led_is_on = 0' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' disable='1' cmdcolor='1975743' cmdcolor_sec='1975743' component='led_3' macro='TurnOff' />
								<command class_type='calculation' title='Calculation' disable='1' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='Led_is_on = 1' />
								</command>
							</flowline>
							<flowline >
								<command class_type='call' title='Call Component Macro' disable='1' cmdcolor='1975743' cmdcolor_sec='1975743' component='led_3' macro='TurnOn' />
								<command class_type='calculation' title='Calculation' disable='1' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='Led_is_on = 0' />
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='comment' title='' comment='UART Ch2 Pin G9 tx2
SPI  Ch2 Pin G6 clk2
I2C  Ch4 Pin G8 scl4
LED4     Pin G15 
IRQ  Timer1' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='UART' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='SPI_Master' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='I2C_Master' macro='Initialise' />
						<command class_type='interrupt' title='Interrupt' disable='1' cmdcolor='3610239' cmdcolor_sec='3610239' enable='1' name='TMR1' call='irq_timer1' >
							<settings timer='1' prescale='256' postscale='-1' rollover='65536' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
								<option value='0' />
								<option value='3' />
								<option value='65536' />
								<option value='-1' />
							</settings>
						</command>
						<command class_type='interrupt' title='Interrupt' disable='1' cmdcolor='3610239' cmdcolor_sec='3610239' enable='1' name='IOCA' call='irq_port_a' >
							<settings timer='0' prescale='-1' postscale='-1' rollover='-1' bitcount='-1' trigger='3' maskhi='MDn-----------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='MDn-----------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
								<option value='-1' />
								<option value='-1' />
								<option value='-1' />
								<option value='-1' />
							</settings>
						</command>
						<command class_type='loop' title='Loop' cmdcolor='3568629' cmdcolor_sec='3568629' type='0' exp='1' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='I2C_Master' macro='Start' />
								<command class_type='loop' title='Loop' cmdcolor='3568629' cmdcolor_sec='3568629' type='2' exp='10' >
									<flowline >
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='UART' macro='SendString' >
											<argument exp='&quot;U&quot;' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='SPI_Master' macro='SendString' >
											<argument exp='&quot;U&quot;' />
										</command>
										<command class_type='comment' title='' comment='Comment' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='I2C_Master' macro='TransmitByte' >
											<argument exp='1' />
										</command>
										<command class_type='delay' title='Delay' cmdcolor='7895044' cmdcolor_sec='7895044' exp='1' type='1' />
									</flowline>
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='I2C_Master' macro='Stop' />
								<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='led_4' macro='TurnOn' />
								<command class_type='delay' title='Delay' cmdcolor='7895044' cmdcolor_sec='7895044' exp='1' type='2' />
								<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='led_4' macro='TurnOff' />
								<command class_type='delay' title='Delay' cmdcolor='7895044' cmdcolor_sec='7895044' exp='1' type='2' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='d92e8259-f3a8-4176-a8c4-fe7ca42b2c3f' vmin='1' vmaj='1' codename='led_4' x='30' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTG.15' />
					<value target='polarity' data='001' />
					<value target='on_color' data='10551200' />
					<value target='length' data='4.000000' />
					<value target='show_label' data='001' />
					<value target='label_property' data='pin' />
					<value target='label_color' data='16777215' />
					<value target='label_scale' data='1.000000' />
					<value target='label_auto_scale' data='0' />
					<value target='label_position' data='003' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='96862c4d-debc-45fa-9433-74711a4b9a3b' vmin='3' vmaj='1' codename='SPI_Master' x='10' y='70' z='0' xsz='60' ysz='26' zsz='1.51' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='CHANNEL' data='002' />
					<value target='PR_SCALE' data='255' />
					<value target='CKP' data='001' />
					<value target='CKE' data='000' />
					<value target='SMP' data='000' />
					<value target='MOSI' data='$PORTF.0' />
					<value target='MISO' data='$PORTD.11' />
					<value target='CLK' data='$PORTG.6' />
					<value target='MosiRemap' data='022' />
					<value target='MisoRemap' data='003' />
					<value target='ClkRemap' data='' />
					<value target='label' data='SPI  Master' />
					<value target='ScopeTraces' data='0' />
					<value target='ConsoleData' data='0' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='0' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='24219805-113d-4b12-b6bd-e1b0b0c33981' vmin='4' vmaj='1' codename='I2C_Master' x='10' y='40' z='0' xsz='60' ysz='26' zsz='1.51' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='CHANNEL' data='000' />
					<value target='BAUD_LIST' data='001' />
					<value target='SRC' data='000' />
					<value target='SMB' data='000' />
					<value target='StopDelay' data='1' />
					<value target='BAUD' data='50000' />
					<value target='SDA' data='$PORTG.7' />
					<value target='SCL' data='$PORTG.8' />
					<value target='label' data='I2C Master' />
					<value target='ScopeTraces' data='0' />
					<value target='ConsoleData' data='' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='c73616d1-7ad0-45d9-aada-69ccfa4c5efc' vmin='0' vmaj='2' codename='UART' x='10' y='100' z='0' xsz='60' ysz='26' zsz='1.51' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='CHANNEL' data='000' />
					<value target='BAUD_LIST' data='009' />
					<value target='BAUD' data='110000' />
					<value target='DBITS' data='008' />
					<value target='RETURN' data='000' />
					<value target='ToutVal' data='255' />
					<value target='FLOWEN' data='000' />
					<value target='ECHO' data='000' />
					<value target='TX' data='$PORTG.9' />
					<value target='RX' data='$PORTD.12' />
					<value target='CTS' data='$PORTB.1' />
					<value target='RTS' data='$PORTB.2' />
					<value target='TXRemap' data='001' />
					<value target='RXRemap' data='009' />
					<value target='label' data='UART_USB' />
					<value target='ScopeTraces' data='0' />
					<value target='ConsoleData' data='0' />
					<value target='ConsoleColumns' data='64' />
					<value target='DataSource' data='001' />
					<value target='com_port' data='003' />
					<value target='Injector' data='000' />
					<value target='InjectorHandle' data='' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='fc04a65f-f03d-40c8-9f69-0d23d2daac29' vmin='1' vmaj='1' codename='pcb_switch1' x='-50' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTA.4' />
					<value target='polarity' data='000' />
					<value target='debounce' data='' />
					<value target='operation' data='000' />
					<value target='color' data='6908265' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='fc04a65f-f03d-40c8-9f69-0d23d2daac29' vmin='1' vmaj='1' codename='pcb_switch2' x='-30' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTA.5' />
					<value target='polarity' data='000' />
					<value target='debounce' data='' />
					<value target='operation' data='000' />
					<value target='color' data='6908265' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='d92e8259-f3a8-4176-a8c4-fe7ca42b2c3f' vmin='1' vmaj='1' codename='led_3' x='10' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTB.11' />
					<value target='polarity' data='001' />
					<value target='on_color' data='10551200' />
					<value target='length' data='4.000000' />
					<value target='show_label' data='001' />
					<value target='label_property' data='pin' />
					<value target='label_color' data='16777215' />
					<value target='label_scale' data='1.000000' />
					<value target='label_auto_scale' data='0' />
					<value target='label_position' data='003' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='2105930' img='' style='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='23' />
		<camera xe='-11.5746' ye='18.3243' ze='167.633' xt='-11.5746' yt='18.3243' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
	</panel3d>
	<layout >
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAAwYAAAgFAAA' zoom='75' scrollx='0' scrolly='90' flags='0' />
		<view type='0' name='irq_port_a' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAAwYAAAgFAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='irq_timer1' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAAwYAAAgFAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
