<root>
<document schema='101' license='1,cardac,T46VX8' title='' description='' target='PIC.16F.16F1936' >
	<config data='!0,fe4!10,1633%0,4%3,0%5,1%6,1%7,1%8,1%9,3%b,1%c,0%d,0%10,3%14,3%18,0%19,1%1a,1%1c,1%1d,0' clkspd='16000000' simspd='2' 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='' body='' />
	<debug >
		<watch expr='edgecount' />
		<watch expr='counting' />
		<watch expr='digit' />
		<watch expr='index' />
		<watch expr='switch' />
		<watch expr='keyloq' />
	</debug>
	<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='11' />
			<data name='CalculatedCommsDelay' value='11' />
		</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='efc47575-fa7f-4201-9627-fe97aa3d900d' 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='count' type='s32' 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='switch' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='counting' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='index' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='keyloq' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='digit' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='PW' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='edgecount' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</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='flag' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='pulse_width_sorter' description='select one of two numbers.. either 25, or 50.. from the bit array, and
return the number in variable called PW
0 = 50, and 1 = 25' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='call' title='go get a value out the array.. of either &apos;0&apos; or &apos;1&apos;..' cmdcolor='1975743' cmdcolor_sec='1975743' component='lut1' macro='GetInt' >
							<return exp='digit' />
							<argument exp='index' />
						</command>
						<command class_type='decision' title='Decide - is digit a &apos;0&apos; or a &apos;1&apos; ..' cmdcolor='3568629' cmdcolor_sec='3568629' exp='digit = 0' swap='0' >
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='PW = 50 // space .. 800 usec wide &apos;0&apos;' />
								</command>
							</flowline>
							<flowline >
								<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='PW = 25 // mark .. 400 usec wide &apos;1&apos;' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='index is position along the array of 0 and 1 ..' cmdcolor='7895044' cmdcolor_sec='7895044' >
							<exp exp='index = index + 1' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='IOC_Int' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
							<exp exp='edgecount = edgecount + 1' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='The PWM output will need to be connected across to pin A0 and the trigger switch connected to A1.
The PWM output - PIN13 - C2  will need to be connected across to PIN21 -B0 and the trigger switch connected to C4 - PIN15' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='C Code' ccode='/*
  Enter C code below this comment
*/
OSCCON = 0x78;' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='loop' title='Loop' cmdcolor='3568629' cmdcolor_sec='3568629' type='0' exp='1' >
							<flowline >
								<command class_type='comment' title='' comment='test for &apos;flag&apos; which is true
if a &apos;button press&apos; duration
is too long.. this loop is a 
delay loop.. to stop too many
pulse trains going through on
a button press.' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
								<command class_type='decision' title='Decision' cmdcolor='3568629' cmdcolor_sec='3568629' exp='flag = 1' swap='0' >
									<flowline >
										<command class_type='goto' title='Goto Connection Point' cmdcolor='3389439' cmdcolor_sec='3389439' labelid='0' labelname='' />
									</flowline>
									<flowline />
								</command>
								<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='sw_push_rnd_pnl1' macro='ReadState' >
									<return exp='switch' />
								</command>
								<command class_type='decision' title='Decision - is the switch pressed - on.!!' cmdcolor='3568629' cmdcolor_sec='3568629' exp='switch' swap='0' >
									<flowline >
										<command class_type='calculation' title='enable the &apos;counting&apos; flag ...' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='counting = 1' />
										</command>
										<command class_type='calculation' title='reset the &apos;edgecount&apos; variable - before incrementing begins..' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='edgecount = 0' />
										</command>
										<command class_type='interrupt' title='enable push button - Interrupt on B0' cmdcolor='3610239' cmdcolor_sec='3610239' enable='1' name='IOC0' call='IOC_Int' >
											<settings timer='0' prescale='-1' postscale='-1' rollover='-1' bitcount='-1' trigger='3' maskhi='AAEAAAD-------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='AAEAAAD-------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
												<option value='-1' />
												<option value='-1' />
												<option value='-1' />
												<option value='-1' />
											</settings>
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='PWM1' macro='Enable' />
										<command class_type='comment' title='' comment='Sets the PWM duty cycle in terms of on/off based on the current period setting.
E.g. if period = 255 then duty of 128 is equal to 50% on and 50% off.
16-bit PIC users should use the 10bit duty function to access the full range.' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='PWM1' macro='SetDutyCycle' >
											<argument exp='37' />
										</command>
										<command class_type='loop' title='Loop-  while counting is a &apos;1&apos; ..' cmdcolor='3568629' cmdcolor_sec='3568629' type='0' exp='counting' >
											<flowline >
												<command class_type='decision' title='24 edges detected?' cmdcolor='3568629' cmdcolor_sec='3568629' exp='edgecount = 24' swap='0' >
													<flowline >
														<command class_type='comment' title='' comment='soon as 24 edges are detected
.. reset the &apos;counting&apos; flag
to &apos;0&apos; ...

.. the &apos;edgecount&apos; variable is
incremented, every time a
&apos;rising&apos; edge, and &apos;falling&apos;
edge is detected at B0...' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
														<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
															<exp exp='counting = 0' />
														</command>
													</flowline>
													<flowline />
												</command>
											</flowline>
										</command>
										<command class_type='comment' title='' comment='exit the loop here...

disable the PWM1 ...
' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='PWM1' macro='Disable' />
										<command class_type='comment' title='' comment='disable the IOC PORTA ..
pin on B0..' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='comment' title='' comment='the &apos;flag&apos; is set and used to waste time
so that if the &apos;button press&apos; is too
long.. then there will not be extra
pulse trains generated..' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='flag = 1' />
											<exp exp='count = 0' />
										</command>
										<command class_type='delay' title='Delay' cmdcolor='7895044' cmdcolor_sec='7895044' exp='4' type='1' />
										<command class_type='comment' title='' comment='this section generates 32 pulses
of two widths wide.
either 400 usec wide or
800 usec wide.' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='calculation' title='enable &apos;counting&apos; flag' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='counting = 1' />
										</command>
										<command class_type='calculation' title='reset &apos;edgecount&apos; variable.. before counting begins..' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='edgecount = 0' />
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='PWM1' macro='Enable' />
										<command class_type='loop' title='Loop -- whilst counting = 1' cmdcolor='3568629' cmdcolor_sec='3568629' type='0' exp='counting' >
											<flowline >
												<command class_type='call' title='pulse width selector.. 0=50 : 1=25' cmdcolor='1975743' cmdcolor_sec='1975743' macro='pulse_width_sorter' />
												<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='PWM1' macro='SetDutyCycle' >
													<argument exp='PW' />
												</command>
												<command class_type='decision' title='Decision' cmdcolor='3568629' cmdcolor_sec='3568629' exp='edgecount = 64' swap='0' >
													<flowline >
														<command class_type='comment' title='' comment='soon as 64 edges are detected
.. reset the &apos;counting&apos; flag
to &apos;0&apos; ...

.. the &apos;edgecount&apos; variable is
incremented, every time a
&apos;rising&apos; edge, and &apos;falling&apos;
edge is detected at B0...


' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
														<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
															<exp exp='counting = 0' />
															<exp exp='index = 0' />
														</command>
													</flowline>
													<flowline />
												</command>
											</flowline>
										</command>
										<command class_type='call' title='Call Component Macro' cmdcolor='1975743' cmdcolor_sec='1975743' component='PWM1' macro='Disable' />
									</flowline>
									<flowline >
										<command class_type='label' title='Connection Point' cmdcolor='3389439' cmdcolor_sec='3389439' labelid='0' labelname='A' />
										<command class_type='comment' title='' comment='simple delay routine..' textarea='12,0,12,0' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='count = count + 1' />
										</command>
										<command class_type='decision' title='Decision' cmdcolor='3568629' cmdcolor_sec='3568629' exp='count &gt;= 200000' swap='0' >
											<flowline >
												<command class_type='calculation' title='Calculation' cmdcolor='7895044' cmdcolor_sec='7895044' >
													<exp exp='flag = 0' />
													<exp exp='count = 0' />
												</command>
											</flowline>
											<flowline />
										</command>
									</flowline>
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='444fb704-814c-4707-a15c-759ba088505c' vmin='6' vmaj='1' codename='PWM1' x='-80.8567' y='170.641' z='0.8825' 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='1' poslock='1' >
				<resources />
				<properties />
				<values >
					<value target='channel' data='001' />
					<value target='altpin' data='0' />
					<value target='pwm_pin' data='$PORTC.2' />
					<value target='RemapPin' data='000' />
					<value target='timer' data='2' />
					<value target='period' data='74' />
					<value target='prescale' data='006' />
					<value target='period_calc' data='1200.000000' />
					<value target='frequency_calc' data='0.833333' />
					<value target='pwm_prescale' data='64' />
					<value target='SimRep' data='001' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='5c1da48f-ce54-4622-bdd9-fc812e373696' vmin='1' vmaj='1' codename='sw_push_rnd_pnl1' x='-70.5515' y='-115.987' z='-6.175' 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='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='pin' data='$PORTC.4' />
					<value target='polarity' data='000' />
					<value target='debounce' data='10' />
					<value target='operation' data='000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='dfb4d07a-3d70-45d5-83ef-07e3c95d86ab' vmin='4' vmaj='1' codename='lut1' x='70' y='170' z='0' xsz='25' ysz='25' zsz='25' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='StorageType' data='000' />
					<value target='Sign' data='000' />
					<value target='intfixed' data='0,1,1,1,1,0,1,1,0,0,0,1,0,1,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,1,0,0' />
					<value target='floatfixed' data='' />
					<value target='fixedexp' data='0' />
					<value target='EmbedIntoC' data='1' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='3e5cc6d0-3e36-46b8-bc40-f238a5735b6e' vmin='0' vmaj='1' codename='IntOscHelper1' x='-70' y='30' z='0' xsz='25' ysz='25' zsz='25' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='1' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='OscSpeed' data='6' />
					<value target='OscFreq' data='500000' />
					<value target='ClockSpeed' data='16000000' />
					<value target='Info' data='Warning: Clock Speed In Project Options Does Not Match Internal Oscillator Speed' />
					<value target='Code' data='OSCCON = 0x38;' />
				</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='-10.4747' ye='32.4664' ze='390.461' xt='-10.4747' yt='32.4664' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='1' lighting='2' brightness='0' perspective='0' >
		<background rgb='7895160' img='' style='0' />
		<table rgb='8388608' img='' style='0' size='7' />
		<camera xe='-154.173' ye='47.9264' ze='-344.696' xt='-154.173' yt='47.9264' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<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='pulse_width_sorter' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEwYAAMUCAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEwYAAMUCAAA' zoom='75' scrollx='0' scrolly='1806' flags='0' />
		<view type='0' name='IOC_Int' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAEwYAAMUCAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
