<root>
<document scada='0' schema='102' license='1,merkelbachdesign,AW7A5J' title='' description='' fcversion='524802' target='PIC16.33E.33EP512MU810' >
	<config data='!0,ffff!10,fffb!20,ff39!30,ff7f!40,ffef!50,ffff!60,ffff%0,1%1,1%4,3%10,3%17,1%20,1%22,0%25,1%26,0%30,f%34,1%35,1%36,1%37,0%40,7%43,1%44,0%45,1%50,3%52,1%55,1%60,1%61,1%64,3' clkspd='140000000' simspd='1' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='regelnr' />
	</debug>
	<traces />
	<ghost >
		<FK2 >
			<data name='FK2D0' port='4294967295' pin='4294967295' />
			<data name='FK2D1' port='4294967295' pin='4294967295' />
			<data name='FK2D2' port='4294967295' pin='4294967295' />
			<data name='FK2D3' port='4294967295' pin='4294967295' />
			<data name='FK2D4' port='4294967295' pin='4294967295' />
			<data name='FK2D5' port='4294967295' pin='4294967295' />
			<data name='FK2D6' port='4294967295' pin='4294967295' />
			<data name='FK2D7' port='4294967295' pin='4294967295' />
			<data name='FK2D8' port='4294967295' pin='4294967295' />
			<data name='FK2D9' port='4294967295' pin='4294967295' />
			<data name='FK2D10' port='4294967295' pin='4294967295' />
			<data name='FK2D11' port='4294967295' pin='4294967295' />
			<data name='FK2D12' port='4294967295' pin='4294967295' />
			<data name='FK2D13' port='4294967295' pin='4294967295' />
			<data name='FK2D14' port='4294967295' pin='4294967295' />
			<data name='FK2D15' port='4294967295' pin='4294967295' />
			<data name='FK2A0' port='4294967295' pin='4294967295' />
			<data name='FK2A1' port='4294967295' pin='4294967295' />
			<data name='FK2A2' port='4294967295' pin='4294967295' />
			<data name='FK2A3' port='4294967295' pin='4294967295' />
			<data name='FK2A4' port='4294967295' pin='4294967295' />
			<data name='FK2A5' port='4294967295' pin='4294967295' />
		</FK2>
		<ICD >
			<data name='AnalogPrescaleValue' value='19' />
			<data name='DigitalSampleRate' value='100000' />
			<data name='BreakpointCount' value='8' />
			<data name='CallStackDepthCount' value='8' />
			<data name='ClockPort' value='1' />
			<data name='ClockPin' value='1' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='0' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='2' />
			<data name='CalculatedCommsDelay' value='2' />
			<data name='AnalogEB2PrescaleValue' value='2' />
			<data name='DigitalEB2SampleRate' value='100000' />
		</ICD>
		<pins >
			<digital A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
			<analog A='0' B='0' C='0' D='0' E='0' F='0' G='0' H='0' I='0' J='0' K='0' L='0' M='0' N='0' O='0' P='0' Q='0' R='0' S='0' T='0' U='0' V='0' W='0' X='0' Y='0' Z='0' />
		</pins>
	</ghost>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='5afc2cca-a868-4b1b-bc9c-100de8ef9613' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='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' scadavisible='1' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='displaywaarde' type='u16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='regelnr' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<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='true' type='b1' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='DisplayText' type='T8' description='' isconst='0' isinit='1' usrinit='&quot;  &quot;' setinit='&quot;  &quot;' >
						<array size='20' />
					</def>
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='init' description='initialization' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='clkInit' ccode='/*
  Enter C code below this comment
*/
/***************************************************
* Configure device for 70 Mips with 8 MHZ XTAL
**************************************************/
PLLFBD = 68;              /* M=70 (68 +2)*/
CLKDIVbits.PLLPOST = 0;   /* N1=2 */
CLKDIVbits.PLLPRE = 0;    /* N2=2 */
OSCTUN = 0;         //Tune FRC oscillator, if FRC is used

//Disable Watch Dog Timer
RCONbits.SWDTEN = 0;
//-------------------------------------------------------------------
// Clock switching to incorporate PLL
__builtin_write_OSCCONH(0x03);   // Initiate Clock Switch to Primary
__builtin_write_OSCCONL(0x01);
while (OSCCONbits.COSC != 0x3);

//--------------------------------------------------------------------
//ensure PLL lock before moving on into application code
//--------------------------------------------------------------------
while(OSCCONbits.LOCK != 1);	/* Wait for Pll to Lock */

//USB H/W initialization for 70 MIPs
ACLKCON3 = 0x24C1;
ACLKDIV3 = 0x7;

// Wait for PLL to lock
ACLKCON3bits.ENAPLL = 1;
while(ACLKCON3bits.APLLCK != 1);' cmdcolor='7687168' cmdcolor_sec='8152576' language='C' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='lcd_4x20' macro='Start' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='lcd_4x20' macro='Cursor' >
							<argument exp='0' />
							<argument exp='regelnr' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='can1' macro='Initialise' />
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='USB_Serial1' macro='Initialise' />
					</flowline>
				</macro>
				<macro >
					<flowline name='display_write' description='schrijf lcd 20x4' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='regelnr = 4' swap='0' >
							<flowline />
							<flowline />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='regelnr = 0' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='can1' macro='CheckRx' >
									<return exp='displaywaarde' />
									<argument exp='0' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='DisplayText = &quot;Can rx  &quot;' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='regelnr = 1' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='can1' macro='GetRxIdent' >
									<return exp='displaywaarde' />
									<argument exp='0' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='DisplayText = &quot;can id &quot;' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='regelnr = 2' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='can1' macro='GetRxDataCount' >
									<return exp='displaywaarde' />
									<argument exp='0' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='DisplayText = &quot;can length &quot;' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='regelnr = 3' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='can1' macro='GetRxData' >
									<return exp='displaywaarde' />
									<argument exp='0' />
									<argument exp='0' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='DisplayText = &quot;candata &quot;' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='lcd_4x20' macro='Cursor' >
							<argument exp='0' />
							<argument exp='regelnr' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='lcd_4x20' macro='PrintString' >
							<argument exp='DisplayText' />
						</command>
						<command class_type='call' title='Call Component Macro' cmdcolor='1879295' cmdcolor_sec='5751039' component='lcd_4x20' macro='PrintNumber' >
							<argument exp='displaywaarde' />
						</command>
						<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
							<exp exp='regelnr = regelnr + 1' />
							<exp exp='' />
						</command>
						<command class_type='decision' title='Decision' cmdcolor='12615680' cmdcolor_sec='15376912' exp='regelnr = 4' swap='0' >
							<flowline >
								<command class_type='call' title='Call Component Macro' disable='1' cmdcolor='1879295' cmdcolor_sec='5751039' component='can1' macro='SendBuffer' >
									<argument exp='0' />
								</command>
								<command class_type='calculation' title='Calculation' cmdcolor='16760919' cmdcolor_sec='16760832' >
									<exp exp='regelnr = 0' />
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='init' />
						<command class_type='loop' title='Loop' cmdcolor='12615680' cmdcolor_sec='15376912' type='0' exp='1' >
							<flowline >
								<command class_type='delay' title='Delay' cmdcolor='12632064' cmdcolor_sec='16769676' exp='100' type='1' />
								<command class_type='call' title='Call Macro' cmdcolor='1879295' cmdcolor_sec='5751039' macro='display_write' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='a2b40602-5421-4e2f-ba82-96db1be51d69' vmin='1' vmaj='1' codename='lcd_4x20' x='-40' 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' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='Pin_Data_0' data='$PORTA.14' />
					<value target='Pin_Data_1' data='$PORTA.15' />
					<value target='Pin_Data_2' data='$PORTD.8' />
					<value target='Pin_Data_3' data='$PORTF.8' />
					<value target='Pin_RS' data='$PORTA.3' />
					<value target='Pin_E' data='$PORTA.2' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='da332928-6342-4c2c-afc7-eaf33917d33e' vmin='4' vmaj='2' codename='can1' x='40' y='-10' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='CHANNEL_CAN' data='001' />
					<value target='EXT_OSC' data='0' />
					<value target='BUS_RATE' data='002' />
					<value target='SJW' data='000' />
					<value target='SAMPLE' data='002' />
					<value target='cal_can::CCFG' data='0' />
					<value target='EXID' data='000' />
					<value target='REF' data='0' />
					<value target='OSC' data='140000000' />
					<value target='BAUD1' data='1' />
					<value target='BAUD2' data='209' />
					<value target='BAUD3' data='3' />
					<value target='cal_spi::CHANNEL' data='000' />
					<value target='cal_spi::MOSI' data='$PORTE.5' />
					<value target='cal_spi::MOSIPins' data='000' />
					<value target='cal_spi::MISO' data='$PORTE.6' />
					<value target='cal_spi::MISOPins' data='086' />
					<value target='cal_spi::CLK' data='$PORTE.7' />
					<value target='cal_spi::CLKPins' data='001' />
					<value target='cal_spi::SS' data='$PORTC.2' />
					<value target='cal_spi::PR_SCALE' data='016' />
					<value target='cal_spi::SMP' data='001' />
					<value target='TXPin' data='$PORTD.0' />
					<value target='TXRemap' data='013' />
					<value target='RXPin' data='$PORTD.11' />
					<value target='RXRemap' data='075' />
					<value target='TXB0ID' data='99' />
					<value target='TXB0LEN' data='8' />
					<value target='TXB0DB0' data='1' />
					<value target='TXB0DB1' data='2' />
					<value target='TXB0DB2' data='3' />
					<value target='TXB0DB3' data='4' />
					<value target='TXB0DB4' data='0' />
					<value target='TXB0DB5' data='0' />
					<value target='TXB0DB6' data='0' />
					<value target='TXB0DB7' data='0' />
					<value target='TXB1ID' data='2' />
					<value target='TXB1LEN' data='2' />
					<value target='TXB1DB0' data='2' />
					<value target='TXB1DB1' data='2' />
					<value target='TXB1DB2' data='0' />
					<value target='TXB1DB3' data='0' />
					<value target='TXB1DB4' data='0' />
					<value target='TXB1DB5' data='0' />
					<value target='TXB1DB6' data='0' />
					<value target='TXB1DB7' data='0' />
					<value target='TXB2ID' data='3' />
					<value target='TXB2LEN' data='3' />
					<value target='TXB2DB0' data='3' />
					<value target='TXB2DB1' data='3' />
					<value target='TXB2DB2' data='3' />
					<value target='TXB2DB3' data='0' />
					<value target='TXB2DB4' data='0' />
					<value target='TXB2DB5' data='0' />
					<value target='TXB2DB6' data='0' />
					<value target='TXB2DB7' data='0' />
					<value target='RXB0CFG' data='002' />
					<value target='RXM0' data='1807' />
					<value target='RXF0' data='697' />
					<value target='Filter0' data='0x0209
0x0219
0x0229
0x0239
0x0249
0x0259
0x0269
0x0279
0x0289
0x0299
0x02a9
0x02b9
0x02c9
0x02d9
0x02e9
0x02f9
' />
					<value target='RXF1' data='697' />
					<value target='Filter1' data='0x0209
0x0219
0x0229
0x0239
0x0249
0x0259
0x0269
0x0279
0x0289
0x0299
0x02a9
0x02b9
0x02c9
0x02d9
0x02e9
0x02f9
' />
					<value target='RXB1CFG' data='000' />
					<value target='RXM1' data='1807' />
					<value target='RXF2' data='697' />
					<value target='Filter2' data='0x0209
0x0219
0x0229
0x0239
0x0249
0x0259
0x0269
0x0279
0x0289
0x0299
0x02a9
0x02b9
0x02c9
0x02d9
0x02e9
0x02f9
' />
					<value target='RXF3' data='0' />
					<value target='Filter3' data='0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x80
0x90
0xa0
0xb0
0xc0
0xd0
0xe0
0xf0
' />
					<value target='RXF4' data='0' />
					<value target='Filter4' data='0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x80
0x90
0xa0
0xb0
0xc0
0xd0
0xe0
0xf0
' />
					<value target='RXF5' data='0' />
					<value target='Filter5' data='0x00
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x80
0x90
0xa0
0xb0
0xc0
0xd0
0xe0
0xf0
' />
					<value target='MIAC' data='0' />
					<value target='label' data='CAN Bus' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='3e28ac22-2855-410a-9660-0b0a4731e545' vmin='6' vmaj='1' codename='USB_Serial1' x='-60' y='-40' z='0' xsz='64' ysz='32' zsz='1.53' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='vendor_ID' data='4799' />
					<value target='product_ID' data='61456' />
					<value target='dev_name' data='Flowcode USB Serial' />
					<value target='dev_manufacturer' data='Matrix Multimedia Ltd.' />
					<value target='major_version' data='1' />
					<value target='minor_version' data='0' />
					<value target='RETURN' data='000' />
					<value target='enumeration_tout' data='0' />
					<value target='timeout' data='10' />
					<value target='usb_type' data='1' />
					<value target='TXBUFSZ' data='64' />
					<value target='RXBUFSZ' data='64' />
					<value target='driver_directory' data='$(srcdir)' />
					<value target='driver_filename' data='Flowcode_USB_Serial_Driver' />
					<value target='gen_driver' data='' />
					<value target='COM_port' data='001' />
					<value target='label' data='USB Serial' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<scadaresourcelookup />
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' >
		<background rgb='7292207' img='' style='0' />
		<camera xe='-19.363' ye='-12.7541' ze='245.677' xt='-19.363' yt='-12.7541' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='1' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' 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='init' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEgUAABwDAAA' zoom='75' scrollx='0' scrolly='115' flags='0' />
		<view type='0' name='display_write' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEgUAABwDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEgUAABwDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
