<root>
<document scada='0' schema='103' license='1,93986072,CDX9QB' title='' description='' fcversion='590593' target='PIC.18F.18F67K22' >
	<config data='!0,12b7!10,fcff!20,7fff!30,fffe!40,ffff!50,ffff!60,ffff%0,1%3,2%6,0%8,2%c,1%d,0%e,0%f,0%10,1%11,3%13,3%15,3%18,0%1a,1f%20,1%28,1%2b,1%2f,0%30,0%34,1%37,1%40,1%41,1%42,1%43,1%44,1%45,1%46,1%47,1%4e,1%4f,1%50,1%51,1%52,1%53,1%54,1%55,1%56,1%57,1%5d,1%5e,1%5f,1%60,1%61,1%62,1%63,1%64,1%65,1%66,1%67,1%6e,1' clkspd='64000000' simspd='0' usewdt='0' constif='0' Use3V3='0' />
	<plugins >
		<dll_models enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='Face_Number' />
	</debug>
	<traces >
		<trace digital='1' displayname='$PORTC.3' portdata='50462722' scopetype='1' showtrace='1' autonamed='1' channel='0' />
	</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='6' />
			<data name='DataPort' value='1' />
			<data name='DataPin' value='7' />
			<data name='UseDefaultPins' value='1' />
			<data name='WrapEnabled' value='1' />
			<data name='CommsDelayOverridden' value='0' />
			<data name='CommsDelay' value='3' />
			<data name='CalculatedCommsDelay' value='3' />
			<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='0' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='33764761-31b7-4d02-8fde-5fcf917ab635' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' category2='' category3='' bIs2dOnly='0' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='1' scadaCompatible='0' embeddedCompatible='1' iconpath='' />
		<gdiopts FullContainer='1' FullTransparency='1' ShowGdi='1' ShowOpengl='1' />
		<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' comp2dType='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='FMK' type='u16' description='FM Калибровка' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Bip' type='b1' description='Озвучка кнопки' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='AM3' type='u16' description='Амплитуда AM3' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Face_Number' type='u8' description='Номер интерфейса' isconst='0' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='AM2' type='u16' description='Амплитуда AM2' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Face_Drive' type='b1' description='Бит команда строить интерфейс' isconst='0' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='AM1' type='u16' description='Амплитуда AM1' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Keypad' type='u8' description='Клава' isconst='0' isHidden='0' isinit='1' usrinit='255' setinit='255' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='AMK' type='u16' description='AM калибровка' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Meandr' type='b1' description='Формирование звука' isconst='0' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Battery' type='u16' description='Батарея' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FM3' type='u16' description='Амплитуда FM3' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FM2' type='u16' description='Фаза FM2' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Brightness' type='u8' description='Яркость' isconst='0' isHidden='0' isinit='1' usrinit='125' setinit='125' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Volume' type='u8' description='Громкость' isconst='0' isHidden='0' isinit='1' usrinit='31' setinit='31' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='FM1' type='u16' description='Фаза FM1' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='Stat_EOP' type='u32' description='Буффер статистики EOP' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='EOP' type='u16' description='Опорное напряжение' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='ST_EOP' type='u8' description='Счётчик статистики опорного напряжения' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isHidden='0' isinit='1' usrinit='1' setinit='1' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='Leading' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='ADC start' ccode='GO = 1;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='FastRun' description='' statediag='0' >
						<return name='Return' type='u8' description='' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='AM' type='u32' description='Амплитуда' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<param name='FM' type='u32' description='Фаза' isconst='0' isHidden='0' isinit='0' usrinit='0' setinit='' />
						<local name='WD' type='u16' description='Быстрое WDI' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
							<exp exp='.WD = (.AM &lt;&lt; 8) / .FM / 2.56' />
						</command>
						<command class_type='decision' title='' textarea='75,14,75,14' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.WD &gt; 950 &amp; .WD &lt; 1050' swap='0' >
							<flowline />
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='ADC_Int' description='ADC interrupts' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<local name='BUF' type='u16' description='Буфер АЦП' isconst='0' isHidden='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='native' title='' ccode='FCL_BUF = ADRESL | (ADRESH&lt;&lt;8);' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
						<command class_type='switch' title='' textarea='36,157,36,157' ccode='switch (ADCON0){
' customize='1' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='0' >
							<case >
								<flowline />
							</case>
							<case exp='65 //AN16' >
								<flowline >
									<command class_type='comment' title='' comment='EOP' textarea='43,40,43,40' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=21;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='ST_EOP = 250' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='EOP = Stat_EOP / ST_EOP' />
												<exp exp='Stat_EOP = 0' />
												<exp exp='ST_EOP = 0' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='Stat_EOP = Stat_EOP + .BUF' />
												<exp exp='ST_EOP = ST_EOP + 1' />
											</command>
										</flowline>
									</command>
								</flowline>
							</case>
							<case exp='21 //AN5' >
								<flowline >
									<command class_type='comment' title='' comment='AM1' textarea='43,40,43,40' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=11;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.BUF &gt; EOP' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='AM1 = .BUF - EOP' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='AM1 = EOP - .BUF' />
											</command>
										</flowline>
									</command>
									<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
										<exp exp='AMK = .BUF' />
									</command>
								</flowline>
							</case>
							<case exp='9 //AN2' >
								<flowline >
									<command class_type='comment' title='' comment='FM1' textarea='36,39,36,39' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=13;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.BUF &gt; EOP' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='FM1 = .BUF - EOP' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='FM1 = EOP - .BUF' />
											</command>
										</flowline>
									</command>
									<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
										<exp exp='FMK = .BUF' />
									</command>
									<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' macro='FastRun' >
										<argument exp='AM1' />
										<argument exp='FM1' />
									</command>
								</flowline>
							</case>
							<case exp='13 //AN3' >
								<flowline >
									<command class_type='comment' title='' comment='AM2' textarea='36,40,36,40' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=7;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.BUF &gt; EOP' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='AM2 = .BUF - EOP' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='AM2 = EOP - .BUF' />
											</command>
										</flowline>
									</command>
								</flowline>
							</case>
							<case exp='5 //AN1' >
								<flowline >
									<command class_type='comment' title='' comment='FM2' textarea='39,37,39,37' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=29;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.BUF &gt; EOP' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='FM2 = .BUF - EOP' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='FM2 = EOP - .BUF' />
											</command>
										</flowline>
									</command>
									<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' macro='FastRun' >
										<argument exp='AM2' />
										<argument exp='FM2' />
									</command>
								</flowline>
							</case>
							<case exp='29 //AN7' >
								<flowline >
									<command class_type='comment' title='' comment='AM3' textarea='41,38,41,38' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=3;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' textarea='99,17,99,17' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.BUF &gt; EOP' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='AM3 = .BUF - EOP' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='AM3 = EOP - .BUF' />
											</command>
										</flowline>
									</command>
								</flowline>
							</case>
							<case exp='1 //AN0' >
								<flowline >
									<command class_type='comment' title='' comment='FM3' textarea='44,29,44,29' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=17;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' textarea='82,13,82,13' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='.BUF &gt; EOP' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='FM3 = .BUF - EOP' />
											</command>
										</flowline>
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='FM3 = EOP - .BUF' />
											</command>
										</flowline>
									</command>
									<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' macro='FastRun' >
										<argument exp='AM3' />
										<argument exp='FM3' />
									</command>
								</flowline>
							</case>
							<case exp='17 //AN4' >
								<flowline >
									<command class_type='comment' title='' comment='BAT' textarea='40,37,40,37' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
									<command class_type='native' title='' ccode='ADCON0=67;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
									<command class_type='decision' title='' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='ST_EOP = 250' swap='0' >
										<flowline >
											<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
												<exp exp='Battery = .BUF' />
											</command>
										</flowline>
										<flowline />
									</command>
								</flowline>
							</case>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='BIPER' description='' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
							<exp exp='Bip = 1' />
						</command>
						<command class_type='delay' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='10' type='1' />
						<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
							<exp exp='Bip = 0' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='PIC18F67K22 ' statediag='0' >
						<return name='Return' type='v0' description='' isconst='0' isHidden='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='Port Configuration' textshow='0' ccode='//Port Configuration

PORTB = 0b00000000; 
TRISB = 0b00000001; 

PORTG = 0b00000001; 
TRISG = 0b00010000;

PORTF = 0b00000000; 
TRISF = 0b10100100; 

PORTE = 0b00000000;
TRISE = 0b11100000;

PORTA = 0b00000000; 
TRISA = 0b11111111; 

PORTC = 0b00000101; 
TRISC = 0b00000000; 

PORTD = 0b00100000;
TRISD = 0b00000000;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
						<command class_type='native' title='Apply voltage to the 10v boost regulator' ccode='TRISB0 = 0;' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
						<command class_type='delay' title='Time to enter mode' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='300' type='1' />
						<command class_type='comment' title='' comment='__________________ INITIALIZING THE DISPLAY ____________________' textarea='36,75,36,75' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
						<command class_type='call' title='Initialization' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='Initialise' />
						<command class_type='call' title='Orientation' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='SetDisplayOrientation' >
							<argument exp='2' />
						</command>
						<command class_type='comment' title='' comment='_______________ PWM SETTING ________________' textarea='42,81,42,81' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
						<command class_type='native' title='Start' ccode='CCP3CON = 12; 
CCPR3L = 125; // Duty factor
PR2 = 255; // Frequency
T2CON = 6; // Start TMR2' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
						<command class_type='comment' title='' comment='_________________ ADC SETUP _________________' textarea='36,73,36,73' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
						<command class_type='native' title='Settings' ccode='ADCON1 = 48;  // Internal VREF+ (4.096V)
ADCON2 = 166; // ADC settings
ANCON0 = 63;  // ADC analog input settings
ANCON1 = 3;   // ADC analog input settings
ANCON2 = 6;   // ADC analog input settings
ADCON0 = 17;  // Start with AN4 BAT' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' language='C' />
						<command class_type='comment' title='' comment='_____________ INTERRUPTS ______________' textarea='36,80,36,80' cmdcolor='1967002' cmdcolor_sec='1967002' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' />
						<command class_type='interrupt' title='Main beat' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' enable='1' name='TMR4' call='Leading' >
							<custom name='TMR4_Inter' handler='if(TMR4IF)
{
FCM_%n(); 
TMR4IF=0;
};' enable='INTCON = 192;
T4CON = 41;
PR4 = 200;
TMR4IE = 1;
TMR4ON = 1;
' disable='' />
						</command>
						<command class_type='interrupt' title='ADC interrupts' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' enable='1' name='' call='ADC_Int' >
							<custom name='ADC' handler='if(ADIF)
{
FCM_%n(); 
ADIF=0;
};' enable='INTCON = 192;
ADIE = 1;
ADCON0 = 21;' disable='' />
						</command>
						<command class_type='loop' title='______________________ PROGRAM CYCLE _________________________' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' type='0' exp='1' >
							<flowline >
								<command class_type='decision' title='Build an interface' textarea='66,23,66,23' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='Face_Drive' swap='0' >
									<flowline >
										<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='SetBackgroundColour' >
											<argument exp='0' />
										</command>
										<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='SetForegroundColour' >
											<argument exp='0' />
										</command>
										<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='ClearDisplay' />
										<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='SetForegroundColour' >
											<argument exp='1' />
										</command>
										<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='DrawLine' >
											<argument exp='0' />
											<argument exp='8' />
											<argument exp='127' />
											<argument exp='8' />
										</command>
										<command class_type='switch' title='Selecting an interface' textarea='36,246,36,246' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='Face_Number' >
											<case >
												<flowline />
											</case>
											<case exp='1' >
												<flowline foldedBeforeTotalFold='1' >
													<command class_type='call' title='Component Macro' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='DrawRectangle' >
														<argument exp='10' />
														<argument exp='20' />
														<argument exp='40' />
														<argument exp='50' />
														<argument exp='0' />
														<argument exp='1' />
													</command>
													<command class_type='call' title='SCANNING' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='Print' >
														<argument exp='&quot;SCANNING&quot;' />
														<argument exp='0' />
														<argument exp='0' />
														<argument exp='0' />
														<argument exp='0' />
													</command>
												</flowline>
											</case>
											<case exp='2' >
												<flowline foldedBeforeTotalFold='1' >
													<command class_type='call' title='PRELIMINARY SURVEY' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='Print' >
														<argument exp='&quot;PRELIMINARY SURVEY&quot;' />
														<argument exp='0' />
														<argument exp='0' />
														<argument exp='0' />
														<argument exp='0' />
													</command>
												</flowline>
											</case>
											<case exp='3' >
												<flowline foldedBeforeTotalFold='1' >
													<command class_type='call' title='SURVEY' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='gLCD_ST7567_SPI1' macro='Print' >
														<argument exp='&quot;SURVEY&quot;' />
														<argument exp='0' />
														<argument exp='0' />
														<argument exp='0' />
														<argument exp='0' />
													</command>
												</flowline>
											</case>
										</command>
										<command class_type='calculation' title='' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
											<exp exp='Face_Drive = 0' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='keypad_cursor1' macro='GetNumber' >
									<return exp='Keypad' />
								</command>
								<command class_type='decision' title='The button is pressed' textarea='83,16,83,16' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='Keypad != 255' swap='0' >
									<flowline >
										<command class_type='call' title='' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' macro='BIPER' />
										<command class_type='switch' title='Keyboard decoder' textarea='36,222,36,222' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='Keypad' >
											<case >
												<flowline />
											</case>
											<case exp='1' >
												<flowline />
											</case>
											<case exp='2' >
												<flowline />
											</case>
											<case exp='3' >
												<flowline />
											</case>
											<case exp='4' >
												<flowline >
													<command class_type='switch' title='' textarea='36,200,36,200' cmdcolor='1336547' cmdcolor_sec='1336547' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='Face_Number' >
														<case >
															<flowline />
														</case>
														<case exp='1' >
															<flowline >
																<command class_type='calculation' title='Next interface' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
																	<exp exp='Face_Number = 2' />
																	<exp exp='Face_Drive = 1' />
																</command>
															</flowline>
														</case>
														<case exp='2' >
															<flowline >
																<command class_type='calculation' title='Next interface' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
																	<exp exp='Face_Number = 3' />
																	<exp exp='Face_Drive = 1' />
																</command>
															</flowline>
														</case>
														<case exp='3' >
															<flowline >
																<command class_type='calculation' title='Next interface' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' >
																	<exp exp='Face_Number = 1' />
																	<exp exp='Face_Drive = 1' />
																</command>
															</flowline>
														</case>
													</command>
												</flowline>
											</case>
											<case exp='5' >
												<flowline />
											</case>
											<case exp='6' >
												<flowline />
											</case>
											<case exp='7' >
												<flowline />
											</case>
											<case exp='8' >
												<flowline />
											</case>
											<case exp='9' >
												<flowline />
											</case>
										</command>
										<command class_type='call' title='' textarea='50,3,50,3' cmdcolor='6048783' cmdcolor_sec='6048783' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' component='keypad_cursor1' macro='WaitReleased' />
									</flowline>
									<flowline />
								</command>
								<command class_type='delay' title='Survey time' cmdcolor='4198239' cmdcolor_sec='4198239' cmdcolor_txt='16777215' cmdgradient='0' cmdopacity='1' exp='10' type='1' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='7e19b0ee-6cfd-49d3-8efb-67e7b145dfba' vmin='5' vmaj='1' codename='gLCD_ST7567_SPI1' x='-1.40994' y='374.456' z='0.17345' xsz='5.31377' ysz='5.31377' zsz='1' xang='0' yang='0' zang='0.0205286' xquat='0' yquat='0' zquat='0.000179146' wquat='1' visible='1' scadavisible='1' interactive='1' solid='1' layer='1' poslock='0' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='pixel_width' data='128' />
					<value target='pixel_height' data='64' />
					<value target='monochrome' data='1' />
					<value target='foreground_colour' data='0' />
					<value target='background_colour' data='16777215' />
					<value target='colour_bit_depth' data='1' />
					<value target='red_bit_depth' data='0' />
					<value target='green_bit_depth' data='0' />
					<value target='blue_bit_depth' data='0' />
					<value target='data_pin' data='$PORTC.5' />
					<value target='clock_pin' data='$PORTC.3' />
					<value target='a0_pin' data='$PORTD.7' />
					<value target='chip_sel_pin' data='$PORTD.5' />
					<value target='reset_pin' data='$PORTD.6' />
					<value target='Base_GLCD::FontCount' data='002' />
					<value target='Base_GLCD::gLCD_Font1::Font' data='000' />
					<value target='Base_GLCD::gLCD_Font1::FontSpace' data='001' />
					<value target='Base_GLCD::gLCD_Font1::SpaceWidth' data='008' />
					<value target='Base_GLCD::gLCD_Font2::Font' data='017' />
					<value target='Base_GLCD::gLCD_Font2::FontSpace' data='001' />
					<value target='Base_GLCD::gLCD_Font2::SpaceWidth' data='004' />
					<value target='Base_GLCD::gLCD_Font3::Font' data='002' />
					<value target='Base_GLCD::gLCD_Font3::FontSpace' data='001' />
					<value target='Base_GLCD::gLCD_Font3::SpaceWidth' data='004' />
					<value target='Base_GLCD::gLCD_Font4::Font' data='015' />
					<value target='Base_GLCD::gLCD_Font4::FontSpace' data='001' />
					<value target='Base_GLCD::gLCD_Font4::SpaceWidth' data='004' />
					<value target='DisplayMethod' data='000' />
					<value target='LCDVersion' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='1d24df27-423c-4d91-b2bb-e6ad3e121f14' vmin='0' vmaj='1' codename='keypad_cursor1' x='-115.248' y='222.925' z='0' xsz='2.11804' ysz='2.11804' 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' comp2dType='0' >
				<resources />
				<properties />
				<values >
					<value target='pin_col1' data='$PORTE.2' />
					<value target='pin_col2' data='$PORTE.3' />
					<value target='pin_col3' data='$PORTE.4' />
					<value target='pin_row1' data='$PORTE.5' />
					<value target='pin_row2' data='$PORTE.6' />
					<value target='pin_row3' data='$PORTE.7' />
				</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='0' ye='0' ze='533.853' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<viewport dx='714' dy='1759' zoom='161.831' fix_topleft='0' />
		<page x='1000' y='1000' show='0' rgb='7360576' />
	</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='781.66' 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='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAiAAAARwoAAEYHAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='ADC_Int' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAiAAAARwoAAEYHAAA' zoom='75' scrollx='3651' scrolly='0' flags='0' />
		<view type='0' name='BIPER' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAiAAAARwoAAEYHAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='FastRun' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAiAAAARwoAAEYHAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Leading' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAiAAAARwoAAEYHAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
