<root>
<document schema='101' license='1,mig_garc_bs,X0F07C' title='SymaX5SC1-BuzzerFinder    -   Abordagem 2' description='' target='PIC.12F.12F675' >
	<config data='!0,3f84%0,4%3,0%4,0%5,0%6,0%7,1%8,1%c,3' clkspd='4000000' 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='255' />
			<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='CameraControlPulseCount' />
		<watch expr='TMR1_INT_COUNTER' />
		<watch expr='BuzzerFlag' />
		<watch expr='TIMER1HIGH' />
	</debug>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='bc9985ab-b00f-4d87-bde8-ab6145697c07' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='Misc' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='0' 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='CameraControlPulseCount' 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='BuzzerFlag' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TIMER1HIGH' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TMR1_INT_COUNTER' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='TimerIsCounting' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='BuzzerToggleInterval' type='u8' 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='INT0_Service' description='' >
						<command class_type='comment' title='' comment='Count camera control pulses, active low (camera yellow wire,
white wire inside SYMA), sent from the RF remote control' textarea='12,0,12,0' />
						<command class_type='calculation' title='Increment CameraControlPulseCount' >
							<exp exp='CameraControlPulseCount = CameraControlPulseCount + 1' />
						</command>
						<command class_type='decision' title='Is this the 1st Camera Control Pulse?' exp='CameraControlPulseCount = 1' swap='0' >
							<flowline >
								<command class_type='interrupt' title='Interrupt Timer1 (Internal Clock 1.907Hz)' enable='1' name='TMR1' call='TMR1_service' >
									<settings timer='1' prescale='8' postscale='-1' rollover='-1' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
										<option value='1' />
										<option value='3' />
										<option value='-1' />
										<option value='-1' />
									</settings>
								</command>
								<command class_type='comment' title='' comment='For testing on GP4:
Active when timer is counting.' textarea='12,0,12,0' />
								<command class_type='calculation' title='Inform timer is counting' >
									<exp exp='TimerIsCounting = 1' />
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='' >
						<command class_type='calculation' title='Initialize Values' >
							<exp exp='CameraControlPulseCount = 0' />
							<exp exp='BuzzerFlag = 0' />
							<exp exp='TMR1_INT_COUNTER = 0' />
							<exp exp='TimerIsCounting = 0' />
							<exp exp='BuzzerToggleInterval = 0' />
							<exp exp='$PORTA.5 = 1' />
							<exp exp='$PORTA.4 = 0' />
						</command>
						<command class_type='comment' title='' comment='Delay to grant a logic level 1 on the Quadcopter Camera control pin 
(the yellow one) before INT0 interrupt is enabled (preventing false
interrupts to be generated on power-up).' textarea='369,167,369,167' />
						<command class_type='delay' title='Delay' disable='1' exp='5' type='2' />
						<command class_type='comment' title='' comment='Camera Control Pulse Signal, active low (camera yellow wire),
is connected to GP2/INT to generate an interrupt on each pulse' textarea='12,0,12,0' />
						<command class_type='interrupt' title='Interrupt INT0 Falling Edge (GP2, pin5)' enable='1' name='INT0' call='INT0_Service' >
							<settings timer='0' prescale='-1' postscale='-1' rollover='-1' bitcount='-1' trigger='2' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
								<option value='1' />
								<option value='-1' />
								<option value='-1' />
								<option value='-1' />
							</settings>
						</command>
						<command class_type='loop' title='Loop' type='0' exp='1' >
							<flowline >
								<command class_type='comment' title='' comment='For test purposes we will output to GP4 the
Timer counting state, to see the time window.' textarea='12,0,12,0' />
								<command class_type='decision' title='   Is Timer Counting ?' exp='TimerIsCounting = 1' swap='0' >
									<flowline >
										<command class_type='output' title='Output' mode='1' port='1048576' mask='16' exp='1' />
									</flowline>
									<flowline >
										<command class_type='output' title='Output' mode='1' port='1048576' mask='16' exp='0' />
									</flowline>
								</command>
								<command class_type='decision' title='Is Buzzer to be sounded?' exp='BuzzerFlag = 1' swap='0' >
									<flowline >
										<command class_type='output' title='Turn Buzzer ON' mode='1' port='1048576' mask='32' exp='0' />
									</flowline>
									<flowline >
										<command class_type='output' title='Turn Buzzer OFF' mode='1' port='1048576' mask='32' exp='1' />
									</flowline>
								</command>
							</flowline>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='TMR1_service' description='' >
						<command class_type='calculation' title='Increment TRM1 INT Counter' >
							<exp exp='TMR1_INT_COUNTER = TMR1_INT_COUNTER + 1' />
						</command>
						<command class_type='decision' title='Has 1.048 seconds passed  [ 2 x (1/1.907) ]  ?' exp='TMR1_INT_COUNTER = 2' swap='0' >
							<flowline >
								<command class_type='comment' title='' comment='Yes, 1.048 seconds passed.
Stop the Timer (prevent it from continuing counting).' textarea='12,0,12,0' />
								<command class_type='interrupt' title='Interrupt Timer1 (Internal Clock 1.907Hz)' enable='0' name='TMR1' >
									<settings timer='1' prescale='1' postscale='-1' rollover='-1' bitcount='-1' trigger='3' maskhi='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' masklo='--------------------------------------------------------------------------------------------------------------------------------------------------------------------------8' >
										<option value='0' />
										<option value='0' />
										<option value='0' />
										<option value='0' />
									</settings>
								</command>
								<command class_type='comment' title='' comment='Reset Timer Counter register values' textarea='12,0,12,0' />
								<command class_type='native' title='C Code' textarea='283,85,283,85' ccode='cr_bit(t1con,TMR1ON);
tmr1h=0x00;
tmr1l=0x00;' language='C' />
								<command class_type='comment' title='' comment='See if during this time window (1.048 seconds) 2 Camera
Control Pulses was sent from SYMA Remote Control' textarea='12,0,12,0' />
								<command class_type='decision' title='Was there 2 pulses from Camera Control Pulse Signal?' exp='CameraControlPulseCount = 2' swap='0' >
									<flowline >
										<command class_type='decision' title='Toggle BuzzerFlag' exp='BuzzerFlag = 0' swap='0' >
											<flowline >
												<command class_type='calculation' title='Set Buzzer Flag to 1' >
													<exp exp='BuzzerFlag = 1' />
												</command>
											</flowline>
											<flowline >
												<command class_type='calculation' title='Set Buzzer Flag to 0' >
													<exp exp='BuzzerFlag = 0' />
												</command>
											</flowline>
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='comment' title='' comment='Reset Timer Counter associated variables.' textarea='12,0,12,0' />
								<command class_type='calculation' title='Reinitialize Variables' >
									<exp exp='CameraControlPulseCount = 0' />
									<exp exp='TMR1_INT_COUNTER = 0' />
									<exp exp='TimerIsCounting = 0' />
								</command>
							</flowline>
							<flowline />
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='fc04a65f-f03d-40c8-9f69-0d23d2daac29' vmin='1' vmaj='1' codename='pcb_switch1' x='0' y='0' z='3.9' 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='$PORTA.2' />
					<value target='polarity' data='001' />
					<value target='debounce' data='25' />
					<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_5mm1' x='0' y='24' z='-1.90735e-007' xsz='2.93578' ysz='2.71186' 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='$PORTA.5' />
					<value target='polarity' data='000' />
					<value target='on_color' data='10551200' />
					<value target='length' data='4.000000' />
					<value target='show_label' data='002' />
					<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='d92e8259-f3a8-4176-a8c4-fe7ca42b2c3f' vmin='1' vmaj='1' codename='led_5mm2' x='0' y='-24' z='-1.90735e-007' xsz='2.93578' ysz='2.71186' 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='$PORTA.4' />
					<value target='polarity' data='001' />
					<value target='on_color' data='10551200' />
					<value target='length' data='4.000000' />
					<value target='show_label' data='002' />
					<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='9737364' img='' style='0' />
		<camera xe='0' ye='0' ze='68.4964' 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='25' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel3d>
	<layout >
		<view type='0' name='INT0_Service' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAA8wIAAKEDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='TMR1_service' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAA8wIAAKEDAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wAAAAAUAAAA8wIAAKEDAAA' zoom='75' scrollx='0' scrolly='72' flags='0' />
	</layout>
</document>
</root>
