;/////////////////////////////////////////////////////////////////////////////////
;// Code Generator: BoostC Compiler - http://www.sourceboost.com
;// Version       : 6.97
;// License Type  : Lite License (Unregistered)
;// Limitations   : PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only
;/////////////////////////////////////////////////////////////////////////////////

	include "P16F688.inc"
; Heap block 0, size:96 (0x000000A0 - 0x000000FF)
__HEAP_BLOCK0_BANK               EQU	0x00000001
__HEAP_BLOCK0_START_OFFSET       EQU	0x00000020
__HEAP_BLOCK0_END_OFFSET         EQU	0x0000007F
; Heap block 1, size:56 (0x00000038 - 0x0000006F)
__HEAP_BLOCK1_BANK               EQU	0x00000000
__HEAP_BLOCK1_START_OFFSET       EQU	0x00000038
__HEAP_BLOCK1_END_OFFSET         EQU	0x0000006F
; Heap block 2, size:0 (0x00000000 - 0x00000000)
__HEAP_BLOCK2_BANK               EQU	0x00000000
__HEAP_BLOCK2_START_OFFSET       EQU	0x00000000
__HEAP_BLOCK2_END_OFFSET         EQU	0x00000000
; Heap block 3, size:0 (0x00000000 - 0x00000000)
__HEAP_BLOCK3_BANK               EQU	0x00000000
__HEAP_BLOCK3_START_OFFSET       EQU	0x00000000
__HEAP_BLOCK3_END_OFFSET         EQU	0x00000000
gbl_status                       EQU	0x00000003 ; bytes:1
__mul_16u__0000C_arg_a           EQU	0x0000002F ; bytes:2
__mul_16u__0000C_arg_b           EQU	0x00000031 ; bytes:2
CompTempVarRet378                EQU	0x00000036 ; bytes:2
__mul_16u__0000C_1_i             EQU	0x00000033 ; bytes:1
__mul_16u__0000C_1_t             EQU	0x00000034 ; bytes:2
gbl_indf                         EQU	0x00000000 ; bytes:1
gbl_tmr0                         EQU	0x00000001 ; bytes:1
gbl_pcl                          EQU	0x00000002 ; bytes:1
gbl_fsr                          EQU	0x00000004 ; bytes:1
gbl_porta                        EQU	0x00000005 ; bytes:1
gbl_portc                        EQU	0x00000007 ; bytes:1
gbl_pclath                       EQU	0x0000000A ; bytes:1
gbl_intcon                       EQU	0x0000000B ; bytes:1
gbl_pir1                         EQU	0x0000000C ; bytes:1
gbl_tmr1l                        EQU	0x0000000E ; bytes:1
gbl_tmr1h                        EQU	0x0000000F ; bytes:1
gbl_t1con                        EQU	0x00000010 ; bytes:1
gbl_baudctl                      EQU	0x00000011 ; bytes:1
gbl_spbrgh                       EQU	0x00000012 ; bytes:1
gbl_spbrg                        EQU	0x00000013 ; bytes:1
gbl_rcreg                        EQU	0x00000014 ; bytes:1
gbl_txreg                        EQU	0x00000015 ; bytes:1
gbl_txsta                        EQU	0x00000016 ; bytes:1
gbl_rcsta                        EQU	0x00000017 ; bytes:1
gbl_wdtcon                       EQU	0x00000018 ; bytes:1
gbl_cmcon0                       EQU	0x00000019 ; bytes:1
gbl_cmcon1                       EQU	0x0000001A ; bytes:1
gbl_adresh                       EQU	0x0000001E ; bytes:1
gbl_adcon0                       EQU	0x0000001F ; bytes:1
gbl_option_reg                   EQU	0x00000081 ; bytes:1
gbl_trisa                        EQU	0x00000085 ; bytes:1
gbl_trisc                        EQU	0x00000087 ; bytes:1
gbl_pie1                         EQU	0x0000008C ; bytes:1
gbl_pcon                         EQU	0x0000008E ; bytes:1
gbl_osccon                       EQU	0x0000008F ; bytes:1
gbl_osctune                      EQU	0x00000090 ; bytes:1
gbl_ansel                        EQU	0x00000091 ; bytes:1
gbl_wpu                          EQU	0x00000095 ; bytes:1
gbl_wpua                         EQU	0x00000095 ; bytes:1
gbl_ioc                          EQU	0x00000096 ; bytes:1
gbl_ioca                         EQU	0x00000096 ; bytes:1
gbl_eedath                       EQU	0x00000097 ; bytes:1
gbl_eeadrh                       EQU	0x00000098 ; bytes:1
gbl_vrcon                        EQU	0x00000099 ; bytes:1
gbl_eedata                       EQU	0x0000009A ; bytes:1
gbl_eeadr                        EQU	0x0000009B ; bytes:1
gbl_eecon1                       EQU	0x0000009C ; bytes:1
gbl_eecon2                       EQU	0x0000009D ; bytes:1
gbl_adresl                       EQU	0x0000009E ; bytes:1
gbl_adcon1                       EQU	0x0000009F ; bytes:1
gbl_u16_delai1                   EQU	0x00000020 ; bytes:2
gbl_u16_test                     EQU	0x00000022 ; bytes:2
gbl_u8_pulse                     EQU	0x00000028 ; bytes:1
gbl_u8_led                       EQU	0x00000029 ; bytes:1
gbl_OLD_IN                       EQU	0x0000002A ; bytes:1
gbl_u16_in_adc                   EQU	0x00000024 ; bytes:2
gbl_u16_tempo                    EQU	0x00000026 ; bytes:2
gbl_u8_delai_led_orange          EQU	0x0000002B ; bytes:1
gbl_u8_sortie                    EQU	0x0000002C ; bytes:1
gbl_u8_IN_count                  EQU	0x0000002D ; bytes:1
gbl_IN                           EQU	0x0000002E ; bytes:1
fn_read_ad_00013_arg_u8_channel  EQU	0x0000002F ; bytes:1
CompTempVarRet579                EQU	0x00000032 ; bytes:2
fn_read_ad_00013_1_u16_out       EQU	0x00000030 ; bytes:2
CompTempVar580                   EQU	0x00000032 ; bytes:1
CompTempVar582                   EQU	0x00000032 ; bytes:2
CompTempVar583                   EQU	0x0000002F ; bytes:1
CompTempVar584                   EQU	0x0000002F ; bytes:1
CompTempVar585                   EQU	0x0000002F ; bytes:1
CompTempVar595                   EQU	0x0000002F ; bytes:1
CompTempVar596                   EQU	0x0000002F ; bytes:1
delay_us_00000_arg_del           EQU	0x00000032 ; bytes:1
	ORG 0x00000000
	GOTO	_startup
	ORG 0x00000004
delay_us_00000
; { delay_us ; function begin
	MOVLW 0x01
	ADDWF delay_us_00000_arg_del, F
	RRF delay_us_00000_arg_del, F
	MOVLW 0xFF
	ANDWF delay_us_00000_arg_del, F
label1
	NOP
	DECFSZ delay_us_00000_arg_del, F
	GOTO	label1
	RETURN
; } delay_us function end

	ORG 0x0000000D
fn_read_ad_00013
; { fn_read_adc ; function begin
	MOVLW 0x07
	ANDWF fn_read_ad_00013_arg_u8_channel, W
	MOVWF CompTempVar580
	RLF CompTempVar580, F
	RLF CompTempVar580, F
	MOVLW 0xFC
	ANDWF CompTempVar580, W
	IORLW 0x81
	MOVWF gbl_adcon0
	MOVLW 0x0A
	MOVWF delay_us_00000_arg_del
	CALL delay_us_00000
	BSF gbl_adcon0,1
label2
	BTFSC gbl_adcon0,1
	GOTO	label2
	MOVF gbl_adresh, W
	MOVWF fn_read_ad_00013_1_u16_out
	CLRF fn_read_ad_00013_1_u16_out+D'1'
	MOVF fn_read_ad_00013_1_u16_out, W
	MOVWF fn_read_ad_00013_1_u16_out+D'1'
	CLRF fn_read_ad_00013_1_u16_out
	BSF STATUS, RP0
	MOVF gbl_adresl, W
	BCF STATUS, RP0
	MOVWF CompTempVar582
	CLRF CompTempVar582+D'1'
	MOVF CompTempVar582, W
	ADDWF fn_read_ad_00013_1_u16_out, F
	MOVF CompTempVar582+D'1', W
	BTFSC STATUS,C
	INCF fn_read_ad_00013_1_u16_out+D'1', F
	ADDWF fn_read_ad_00013_1_u16_out+D'1', F
	MOVF fn_read_ad_00013_1_u16_out, W
	MOVWF CompTempVarRet579
	MOVF fn_read_ad_00013_1_u16_out+D'1', W
	MOVWF CompTempVarRet579+D'1'
	RETURN
; } fn_read_adc function end

	ORG 0x00000032
fn_gere_LE_00014
; { fn_gere_LED ; function begin
	BCF STATUS, RP0
	BCF STATUS, RP1
	MOVF gbl_u8_led, W
	XORLW 0x02
	BTFSS STATUS,Z
	GOTO	label3
	MOVLW 0x01
	ANDWF gbl_u8_delai_led_orange, W
	MOVWF CompTempVar583
	BTFSC CompTempVar583,0
	BSF gbl_portc,3
	BTFSS CompTempVar583,0
	BCF gbl_portc,3
	MOVLW 0x01
	ANDWF gbl_u8_delai_led_orange, W
	SUBLW 0x01
	MOVWF CompTempVar584
	BTFSC CompTempVar584,0
	BSF gbl_portc,4
	BTFSS CompTempVar584,0
	BCF gbl_portc,4
	DECF gbl_u8_delai_led_orange, F
	RETURN
label3
	MOVF gbl_u8_led, F
	BTFSS STATUS,Z
	GOTO	label4
	BCF gbl_portc,3
	BSF gbl_portc,4
	RETURN
label4
	DECF gbl_u8_led, W
	BTFSS STATUS,Z
	GOTO	label5
	BSF gbl_portc,3
	BCF gbl_portc,4
	RETURN
label5
	BCF gbl_portc,3
	BCF gbl_portc,4
	RETURN
; } fn_gere_LED function end

	ORG 0x00000058
__mul_16u__0000C
; { __mul_16u_16u__16 ; function begin
	CLRF __mul_16u__0000C_1_i
	CLRF CompTempVarRet378
	CLRF CompTempVarRet378+D'1'
	MOVF __mul_16u__0000C_arg_a, W
	MOVWF __mul_16u__0000C_1_t
	MOVF __mul_16u__0000C_arg_a+D'1', W
	MOVWF __mul_16u__0000C_1_t+D'1'
label6
	BTFSC __mul_16u__0000C_1_i,4
	RETURN
	BTFSS __mul_16u__0000C_arg_b,0
	GOTO	label7
	MOVF __mul_16u__0000C_1_t, W
	ADDWF CompTempVarRet378, F
	MOVF __mul_16u__0000C_1_t+D'1', W
	BTFSC gbl_status,0
	INCFSZ __mul_16u__0000C_1_t+D'1', W
	ADDWF CompTempVarRet378+D'1', F
label7
	BCF gbl_status,0
	RRF __mul_16u__0000C_arg_b+D'1', F
	RRF __mul_16u__0000C_arg_b, F
	BCF gbl_status,0
	RLF __mul_16u__0000C_1_t, F
	RLF __mul_16u__0000C_1_t+D'1', F
	INCF __mul_16u__0000C_1_i, F
	GOTO	label6
; } __mul_16u_16u__16 function end

	ORG 0x00000071
main
; { main ; function begin
	MOVLW 0xD2
	BSF STATUS, RP0
	BCF STATUS, RP1
	MOVWF gbl_option_reg
	MOVLW 0x71
	MOVWF gbl_osccon
	MOVLW 0xFF
	MOVWF gbl_trisa
	MOVLW 0xE5
	MOVWF gbl_trisc
	MOVLW 0x10
	MOVWF gbl_ansel
	MOVLW 0x81
	BCF STATUS, RP0
	MOVWF gbl_adcon0
	MOVLW 0x07
	MOVWF gbl_cmcon0
	CLRF gbl_u16_test
	CLRF gbl_u16_test+D'1'
label8
	MOVLW 0x07
	SUBWF gbl_u16_test+D'1', W
	BTFSS STATUS,Z
	GOTO	label9
	MOVLW 0xD0
	SUBWF gbl_u16_test, W
label9
	BTFSC STATUS,C
	GOTO	label15
label10
	BTFSC gbl_intcon,2
	GOTO	label11
	GOTO	label10
label11
	BCF gbl_intcon,2
	MOVF gbl_u16_test+D'1', W
	SUBLW 0x03
	BTFSS STATUS,Z
	GOTO	label12
	MOVF gbl_u16_test, W
	SUBLW 0xE8
label12
	BTFSC STATUS,C
	GOTO	label13
	CLRF gbl_u8_led
	CLRF gbl_u8_sortie
	GOTO	label14
label13
	MOVLW 0x01
	MOVWF gbl_u8_led
	MOVWF gbl_u8_sortie
label14
	CLRF CompTempVar585
	BTFSC gbl_porta,1
	BSF CompTempVar585,0
	MOVF gbl_u8_sortie, W
	XORWF CompTempVar585, F
	BTFSC CompTempVar585,0
	BSF gbl_portc,1
	BTFSS CompTempVar585,0
	BCF gbl_portc,1
	CALL fn_gere_LE_00014
	INCF gbl_u16_test, F
	BTFSC STATUS,Z
	INCF gbl_u16_test+D'1', F
	GOTO	label8
label15
	MOVLW 0x01
	MOVWF gbl_u8_sortie
	MOVLW 0xFF
	MOVWF gbl_u16_delai1
	MOVWF gbl_u16_delai1+D'1'
label16
	BTFSS gbl_intcon,2
	GOTO	label16
	BCF gbl_intcon,2
	MOVLW 0x04
	MOVWF fn_read_ad_00013_arg_u8_channel
	CALL fn_read_ad_00013
	MOVF CompTempVarRet579, W
	SUBLW 0xFF
	MOVWF gbl_u16_in_adc
	MOVF CompTempVarRet579+D'1', W
	BTFSS STATUS,C
	INCF CompTempVarRet579+D'1', W
	SUBLW 0x03
	MOVWF gbl_u16_in_adc+D'1'
	RRF gbl_u16_in_adc+D'1', F
	RRF gbl_u16_in_adc, F
	RRF gbl_u16_in_adc+D'1', F
	RRF gbl_u16_in_adc, F
	MOVLW 0x3F
	ANDWF gbl_u16_in_adc+D'1', F
	MOVF gbl_u16_in_adc, W
	MOVWF __mul_16u__0000C_arg_a
	MOVF gbl_u16_in_adc+D'1', W
	MOVWF __mul_16u__0000C_arg_a+D'1'
	MOVF gbl_u16_in_adc, W
	MOVWF __mul_16u__0000C_arg_b
	MOVF gbl_u16_in_adc+D'1', W
	MOVWF __mul_16u__0000C_arg_b+D'1'
	CALL __mul_16u__0000C
	MOVF CompTempVarRet378, W
	MOVWF gbl_u16_tempo
	MOVF CompTempVarRet378+D'1', W
	MOVWF gbl_u16_tempo+D'1'
	MOVLW 0x64
	ADDWF gbl_u16_tempo, F
	BTFSC STATUS,C
	INCF gbl_u16_tempo+D'1', F
	BTFSC gbl_porta,5
	GOTO	label17
	INCF gbl_u8_IN_count, F
	GOTO	label18
label17
	CLRF gbl_u8_IN_count
label18
	MOVF gbl_u8_IN_count, W
	SUBLW 0x14
	BTFSC STATUS,C
	GOTO	label19
	MOVLW 0x01
	MOVWF gbl_IN
	GOTO	label20
label19
	CLRF gbl_IN
label20
	BTFSS gbl_porta,2
	GOTO	label29
	MOVF gbl_IN, F
	BTFSC STATUS,Z
	GOTO	label21
	MOVF gbl_IN, W
	XORWF gbl_OLD_IN, W
	BTFSC STATUS,Z
	GOTO	label21
	INCF gbl_u8_pulse, F
	MOVF gbl_u8_pulse, W
	SUBLW 0x06
	BTFSC STATUS,C
	GOTO	label21
	CLRF gbl_u8_sortie
	CLRF gbl_u16_delai1
	CLRF gbl_u16_delai1+D'1'
	CLRF gbl_u8_pulse
label21
	MOVF gbl_u16_tempo+D'1', W
	SUBWF gbl_u16_delai1+D'1', W
	BTFSS STATUS,Z
	GOTO	label22
	MOVF gbl_u16_tempo, W
	SUBWF gbl_u16_delai1, W
label22
	BTFSC STATUS,C
	GOTO	label24
	MOVLW 0xFF
	SUBWF gbl_u16_delai1+D'1', W
	BTFSS STATUS,Z
	GOTO	label23
	MOVLW 0xDC
	SUBWF gbl_u16_delai1, W
label23
	BTFSC STATUS,C
	GOTO	label24
	INCF gbl_u16_delai1, F
	BTFSC STATUS,Z
	INCF gbl_u16_delai1+D'1', F
	GOTO	label27
label24
	MOVF gbl_u16_tempo, W
	XORWF gbl_u16_delai1, W
	BTFSS STATUS,Z
	GOTO	label25
	MOVF gbl_u16_tempo+D'1', W
	XORWF gbl_u16_delai1+D'1', W
	BTFSC STATUS,Z
	GOTO	label26
label25
	MOVF gbl_u16_delai1, W
	XORLW 0xDC
	MOVLW 0xFF
	BTFSC STATUS,Z
	XORWF gbl_u16_delai1+D'1', W
	BTFSC STATUS,Z
label26
	CLRF gbl_u8_pulse
	MOVLW 0x01
	MOVWF gbl_u8_sortie
	MOVLW 0xFF
	MOVWF gbl_u16_delai1
	MOVWF gbl_u16_delai1+D'1'
	INCF gbl_u16_delai1, F
	BTFSC STATUS,Z
	INCF gbl_u16_delai1+D'1', F
label27
	MOVF gbl_IN, W
	MOVWF gbl_OLD_IN
	DECF gbl_u8_sortie, W
	BTFSC STATUS,Z
	CLRF gbl_u8_led
	MOVF gbl_u8_pulse, F
	BTFSC STATUS,Z
	GOTO	label28
	MOVLW 0x02
	MOVWF gbl_u8_led
label28
	MOVF gbl_u8_sortie, F
	BTFSS STATUS,Z
	GOTO	label38
	MOVLW 0x01
	MOVWF gbl_u8_led
	GOTO	label38
label29
	BTFSC gbl_porta,5
	GOTO	label30
	CLRF gbl_u16_delai1
	CLRF gbl_u16_delai1+D'1'
	CLRF gbl_u8_sortie
label30
	MOVF gbl_u16_tempo+D'1', W
	SUBWF gbl_u16_delai1+D'1', W
	BTFSS STATUS,Z
	GOTO	label31
	MOVF gbl_u16_tempo, W
	SUBWF gbl_u16_delai1, W
label31
	BTFSC STATUS,C
	GOTO	label33
	MOVLW 0xFF
	SUBWF gbl_u16_delai1+D'1', W
	BTFSS STATUS,Z
	GOTO	label32
	MOVLW 0xDC
	SUBWF gbl_u16_delai1, W
label32
	BTFSC STATUS,C
	GOTO	label33
	CLRF gbl_u8_sortie
	INCF gbl_u16_delai1, F
	BTFSC STATUS,Z
	INCF gbl_u16_delai1+D'1', F
	GOTO	label34
label33
	MOVLW 0x01
	MOVWF gbl_u8_sortie
	MOVLW 0xFF
	MOVWF gbl_u16_delai1
	MOVWF gbl_u16_delai1+D'1'
label34
	MOVF gbl_u16_tempo+D'1', W
	SUBWF gbl_u16_delai1+D'1', W
	BTFSS STATUS,Z
	GOTO	label35
	MOVF gbl_u16_tempo, W
	SUBWF gbl_u16_delai1, W
label35
	BTFSC STATUS,C
	GOTO	label37
	CLRF CompTempVar595
	BTFSC gbl_porta,5
	GOTO	label36
	INCF CompTempVar595, F
label36
	MOVF CompTempVar595, F
	BTFSS STATUS,Z
	GOTO	label37
	MOVLW 0x02
	MOVWF gbl_u8_led
	GOTO	label38
label37
	CLRF gbl_u8_led
	BTFSC gbl_portc,1
	INCF gbl_u8_led, F
label38
	CLRF CompTempVar596
	BTFSC gbl_porta,1
	BSF CompTempVar596,0
	MOVF gbl_u8_sortie, W
	XORWF CompTempVar596, F
	BTFSC CompTempVar596,0
	BSF gbl_portc,1
	BTFSS CompTempVar596,0
	BCF gbl_portc,1
	CALL fn_gere_LE_00014
	GOTO	label16
; } main function end

	ORG 0x0000016F
_startup
	BCF STATUS, RP0
	BCF STATUS, RP1
	CLRF gbl_u16_delai1
	CLRF gbl_u16_delai1+D'1'
	CLRF gbl_u8_pulse
	BCF PCLATH,3
	BCF PCLATH,4
	GOTO	main
	ORG 0x00002007
	DW 0x3094
	END
