;/////////////////////////////////////////////////////////////////////////////////
;// Code Generator: BoostC Compiler - http://www.sourceboost.com
;// Version       : 6.95
;// License Type  : Full License
;// Limitations   : PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only
;/////////////////////////////////////////////////////////////////////////////////

	include "P16F88.inc"
; Heap block 0, size:112 (0x00000110 - 0x0000017F)
__HEAP_BLOCK0_BANK               EQU	0x00000002
__HEAP_BLOCK0_START_OFFSET       EQU	0x00000010
__HEAP_BLOCK0_END_OFFSET         EQU	0x0000007F
; Heap block 1, size:96 (0x00000190 - 0x000001EF)
__HEAP_BLOCK1_BANK               EQU	0x00000003
__HEAP_BLOCK1_START_OFFSET       EQU	0x00000010
__HEAP_BLOCK1_END_OFFSET         EQU	0x0000006F
; Heap block 2, size:80 (0x000000A0 - 0x000000EF)
__HEAP_BLOCK2_BANK               EQU	0x00000001
__HEAP_BLOCK2_START_OFFSET       EQU	0x00000020
__HEAP_BLOCK2_END_OFFSET         EQU	0x0000006F
; Heap block 3, size:51 (0x0000003D - 0x0000006F)
__HEAP_BLOCK3_BANK               EQU	0x00000000
__HEAP_BLOCK3_START_OFFSET       EQU	0x0000003D
__HEAP_BLOCK3_END_OFFSET         EQU	0x0000006F
__div_16_1_00003_arg_a           EQU	0x00000034 ; bytes:2
__div_16_1_00003_arg_b           EQU	0x00000036 ; bytes:2
CompTempVarRet137                EQU	0x0000003B ; bytes:2
__div_16_1_00003_1_r             EQU	0x00000038 ; bytes:2
__div_16_1_00003_1_i             EQU	0x0000003A ; bytes:1
gbl_status                       EQU	0x00000003 ; bytes:1
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_portb                        EQU	0x00000006 ; bytes:1
gbl_pclath                       EQU	0x0000000A ; bytes:1
gbl_intcon                       EQU	0x0000000B ; bytes:1
gbl_pir1                         EQU	0x0000000C ; bytes:1
gbl_pir2                         EQU	0x0000000D ; bytes:1
gbl_tmr1l                        EQU	0x0000000E ; bytes:1
gbl_tmr1h                        EQU	0x0000000F ; bytes:1
gbl_t1con                        EQU	0x00000010 ; bytes:1
gbl_tmr2                         EQU	0x00000011 ; bytes:1
gbl_t2con                        EQU	0x00000012 ; bytes:1
gbl_sspbuf                       EQU	0x00000013 ; bytes:1
gbl_sspcon                       EQU	0x00000014 ; bytes:1
gbl_ccpr1l                       EQU	0x00000015 ; bytes:1
gbl_ccpr1h                       EQU	0x00000016 ; bytes:1
gbl_ccp1con                      EQU	0x00000017 ; bytes:1
gbl_rcsta                        EQU	0x00000018 ; bytes:1
gbl_txreg                        EQU	0x00000019 ; bytes:1
gbl_rcreg                        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_trisb                        EQU	0x00000086 ; bytes:1
gbl_pie1                         EQU	0x0000008C ; bytes:1
gbl_pie2                         EQU	0x0000008D ; bytes:1
gbl_pcon                         EQU	0x0000008E ; bytes:1
gbl_osccon                       EQU	0x0000008F ; bytes:1
gbl_osctune                      EQU	0x00000090 ; bytes:1
gbl_pr2                          EQU	0x00000092 ; bytes:1
gbl_sspadd                       EQU	0x00000093 ; bytes:1
gbl_sspstat                      EQU	0x00000094 ; bytes:1
gbl_txsta                        EQU	0x00000098 ; bytes:1
gbl_spbrg                        EQU	0x00000099 ; bytes:1
gbl_ansel                        EQU	0x0000009B ; bytes:1
gbl_cmcon                        EQU	0x0000009C ; bytes:1
gbl_cvrcon                       EQU	0x0000009D ; bytes:1
gbl_adresl                       EQU	0x0000009E ; bytes:1
gbl_adcon1                       EQU	0x0000009F ; bytes:1
gbl_wdtcon                       EQU	0x00000105 ; bytes:1
gbl_eedata                       EQU	0x0000010C ; bytes:1
gbl_eeadr                        EQU	0x0000010D ; bytes:1
gbl_eedath                       EQU	0x0000010E ; bytes:1
gbl_eeadrh                       EQU	0x0000010F ; bytes:1
gbl_eecon1                       EQU	0x0000018C ; bytes:1
gbl_eecon2                       EQU	0x0000018D ; bytes:1
gbl_thresh                       EQU	0x00000026 ; bytes:1
gbl_kaisuu                       EQU	0x00000027 ; bytes:1
gbl_count_min                    EQU	0x00000020 ; bytes:2
gbl_count_max                    EQU	0x00000022 ; bytes:2
gbl_reset_time                   EQU	0x00000024 ; bytes:2
main_1_jyotai                    EQU	0x00000028 ; bytes:1
main_1_ad_result                 EQU	0x00000029 ; bytes:1
main_1_i                         EQU	0x0000002A ; bytes:1
main_1_n                         EQU	0x0000002B ; bytes:1
main_1_portb_buf                 EQU	0x0000002C ; bytes:1
main_1_count                     EQU	0x0000002D ; bytes:2
main_1_count3                    EQU	0x0000002F ; bytes:2
main_1_buf                       EQU	0x00000031 ; bytes:2
main_1_out                       EQU	0x00000033 ; bit:0
main_1_test_led                  EQU	0x00000033 ; bit:1
CompTempVar579                   EQU	0x00000034 ; bytes:1
CompTempVar582                   EQU	0x00000034 ; bytes:1
CompTempVar583                   EQU	0x00000035 ; bytes:1
delay_us_00000_arg_del           EQU	0x00000034 ; bytes:1
delay_ms_00000_arg_del           EQU	0x00000034 ; 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
delay_ms_00000
; { delay_ms ; function begin
	MOVF delay_ms_00000_arg_del, F
	BTFSS STATUS,Z
	GOTO	label2
	RETURN
label2
	MOVLW 0xF9
label3
	NOP
	NOP
	NOP
	NOP
	ADDLW 0xFF
	BTFSS STATUS,Z
	GOTO	label3
	NOP
	NOP
	NOP
	NOP
	NOP
	DECFSZ delay_ms_00000_arg_del, F
	GOTO	label2
	RETURN
; } delay_ms function end

	ORG 0x00000021
__div_16_1_00003
; { __div_16_16 ; function begin
	CLRF __div_16_1_00003_1_r
	CLRF __div_16_1_00003_1_r+D'1'
	CLRF CompTempVarRet137
	CLRF CompTempVarRet137+D'1'
	CLRF __div_16_1_00003_1_i
label4
	BTFSC __div_16_1_00003_1_i,4
	RETURN
	BCF STATUS,C
	RLF CompTempVarRet137, F
	RLF CompTempVarRet137+D'1', F
	RLF __div_16_1_00003_arg_a, F
	RLF __div_16_1_00003_arg_a+D'1', F
	RLF __div_16_1_00003_1_r, F
	RLF __div_16_1_00003_1_r+D'1', F
	MOVF __div_16_1_00003_arg_b+D'1', W
	SUBWF __div_16_1_00003_1_r+D'1', W
	BTFSS STATUS,Z
	GOTO	label5
	MOVF __div_16_1_00003_arg_b, W
	SUBWF __div_16_1_00003_1_r, W
label5
	BTFSS STATUS,C
	GOTO	label6
	MOVF __div_16_1_00003_arg_b, W
	SUBWF __div_16_1_00003_1_r, F
	MOVF __div_16_1_00003_arg_b+D'1', W
	BTFSS STATUS,C
	DECF __div_16_1_00003_1_r+D'1', F
	SUBWF __div_16_1_00003_1_r+D'1', F
	BSF CompTempVarRet137,0
label6
	INCF __div_16_1_00003_1_i, F
	GOTO	label4
; } __div_16_16 function end

	ORG 0x00000040
main
; { main ; function begin
	MOVLW 0x70
	BSF STATUS, RP0
	BCF STATUS, RP1
	MOVWF gbl_osccon
	MOVLW 0xFF
	MOVWF gbl_trisa
	CLRF gbl_trisb
	MOVLW 0xFF
	MOVWF gbl_ansel
	MOVLW 0x40
	MOVWF gbl_adcon1
	MOVLW 0x41
	BCF STATUS, RP0
	MOVWF gbl_adcon0
label7
	CLRF gbl_portb
	CLRF main_1_i
label8
	MOVF gbl_kaisuu, W
	SUBWF main_1_i, W
	BTFSC STATUS,C
	GOTO	label9
	BCF gbl_portb,7
	MOVLW 0xFA
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	MOVLW 0x64
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	BSF gbl_portb,7
	MOVLW 0xFA
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	MOVLW 0x64
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	INCF main_1_i, F
	GOTO	label8
label9
	BCF main_1_out,0
	CLRF main_1_portb_buf
	BCF main_1_portb_buf,0
	BTFSC main_1_out,0
	BSF main_1_portb_buf,0
	BCF main_1_portb_buf,7
	BTFSC main_1_out,0
	BSF main_1_portb_buf,7
	CLRF main_1_jyotai
	CLRF main_1_count
	CLRF main_1_count+D'1'
	CLRF main_1_count3
	CLRF main_1_count3+D'1'
	BSF main_1_test_led,1
	BCF main_1_portb_buf,2
	BTFSC main_1_test_led,1
	BSF main_1_portb_buf,2
	MOVF main_1_portb_buf, W
	MOVWF gbl_portb
label10
	INCF main_1_count3, F
	BTFSC STATUS,Z
	INCF main_1_count3+D'1', F
	MOVLW 0x01
	SUBWF main_1_count3+D'1', W
	BTFSS STATUS,Z
	GOTO	label11
	MOVLW 0xF4
	SUBWF main_1_count3, W
label11
	BTFSS STATUS,C
	GOTO	label13
	BCF main_1_portb_buf,2
	BTFSS main_1_test_led,1
	GOTO	label12
	BSF main_1_portb_buf,2
label12
	MOVLW 0xFF
	BTFSC main_1_test_led,1
	MOVLW 0xFE
	MOVWF CompTempVar579
	BCF main_1_test_led,1
	BTFSC CompTempVar579,0
	BSF main_1_test_led,1
	CLRF main_1_count3
	CLRF main_1_count3+D'1'
label13
	MOVLW 0x14
	MOVWF main_1_n
	CLRF main_1_buf
	CLRF main_1_buf+D'1'
	BSF gbl_adcon0,3
	CLRF main_1_i
label14
	MOVF main_1_n, W
	SUBWF main_1_i, W
	BTFSC STATUS,C
	GOTO	label16
	MOVLW 0x14
	MOVWF delay_us_00000_arg_del
	CALL delay_us_00000
	BSF gbl_adcon0,2
label15
	BTFSC gbl_adcon0,2
	GOTO	label15
	MOVF gbl_adresh, W
	ADDWF main_1_buf, F
	MOVF main_1_buf+D'1', F
	BTFSC STATUS,C
	INCF main_1_buf+D'1', F
	INCF main_1_i, F
	GOTO	label14
label16
	MOVF main_1_buf, W
	MOVWF __div_16_1_00003_arg_a
	MOVF main_1_buf+D'1', W
	MOVWF __div_16_1_00003_arg_a+D'1'
	MOVF main_1_n, W
	MOVWF __div_16_1_00003_arg_b
	CLRF __div_16_1_00003_arg_b+D'1'
	CALL __div_16_1_00003
	MOVF CompTempVarRet137, W
	MOVWF main_1_ad_result
	MOVF gbl_thresh, W
	SUBWF main_1_ad_result, W
	BTFSS STATUS,C
	GOTO	label17
	BSF main_1_portb_buf,1
	GOTO	label18
label17
	BCF main_1_portb_buf,1
label18
	MOVF main_1_jyotai, F
	BTFSS STATUS,Z
	GOTO	label20
	MOVF gbl_thresh, W
	SUBWF main_1_ad_result, W
	BTFSS STATUS,C
	GOTO	label34
	CLRF main_1_count
	CLRF main_1_count+D'1'
	MOVF gbl_kaisuu, W
	XORLW 0x03
	BTFSS STATUS,Z
	GOTO	label19
	MOVLW 0x01
	MOVWF main_1_jyotai
	GOTO	label34
label19
	MOVF gbl_kaisuu, W
	XORLW 0x02
	BTFSS STATUS,Z
	GOTO	label7
	MOVLW 0x03
	MOVWF main_1_jyotai
	GOTO	label34
label20
	DECF main_1_jyotai, W
	BTFSC STATUS,Z
	GOTO	label21
	MOVF main_1_jyotai, W
	XORLW 0x03
	BTFSS STATUS,Z
	GOTO	label24
label21
	MOVF gbl_thresh, W
	SUBWF main_1_ad_result, W
	BTFSC STATUS,C
	GOTO	label34
	MOVF gbl_count_max+D'1', W
	SUBWF main_1_count+D'1', W
	BTFSS STATUS,Z
	GOTO	label22
	MOVF gbl_count_max, W
	SUBWF main_1_count, W
label22
	BTFSS STATUS,C
	GOTO	label23
	CLRF main_1_jyotai
	GOTO	label34
label23
	INCF main_1_jyotai, F
	GOTO	label34
label24
	MOVF main_1_jyotai, W
	XORLW 0x02
	BTFSS STATUS,Z
	GOTO	label28
	MOVF gbl_thresh, W
	SUBWF main_1_ad_result, W
	BTFSS STATUS,C
	GOTO	label34
	MOVF gbl_count_min+D'1', W
	SUBWF main_1_count+D'1', W
	BTFSS STATUS,Z
	GOTO	label25
	MOVF gbl_count_min, W
	SUBWF main_1_count, W
label25
	BTFSS STATUS,C
	GOTO	label27
	MOVF main_1_count+D'1', W
	SUBWF gbl_count_max+D'1', W
	BTFSS STATUS,Z
	GOTO	label26
	MOVF main_1_count, W
	SUBWF gbl_count_max, W
label26
	BTFSS STATUS,C
	GOTO	label27
	MOVLW 0x03
	MOVWF main_1_jyotai
	CLRF main_1_count
	CLRF main_1_count+D'1'
	GOTO	label34
label27
	CLRF main_1_jyotai
	GOTO	label34
label28
	MOVF main_1_jyotai, W
	XORLW 0x04
	BTFSS STATUS,Z
	GOTO	label33
	MOVF gbl_thresh, W
	SUBWF main_1_ad_result, W
	BTFSS STATUS,C
	GOTO	label34
	CLRF CompTempVar583
	MOVF gbl_count_min+D'1', W
	SUBWF main_1_count+D'1', W
	BTFSS STATUS,Z
	GOTO	label29
	MOVF gbl_count_min, W
	SUBWF main_1_count, W
label29
	BTFSC STATUS,C
	INCF CompTempVar583, F
	CLRF CompTempVar582
	MOVF main_1_count+D'1', W
	SUBWF gbl_count_max+D'1', W
	BTFSS STATUS,Z
	GOTO	label30
	MOVF main_1_count, W
	SUBWF gbl_count_max, W
label30
	BTFSC STATUS,C
	INCF CompTempVar582, F
	MOVF CompTempVar582, W
	ANDWF CompTempVar583, W
	BTFSC STATUS,Z
	GOTO	label34
	MOVLW 0x05
	MOVWF main_1_jyotai
	BTFSC main_1_out,0
	GOTO	label31
	BSF main_1_out,0
	GOTO	label32
label31
	BCF main_1_out,0
label32
	BCF main_1_portb_buf,0
	BTFSC main_1_out,0
	BSF main_1_portb_buf,0
	BCF main_1_portb_buf,7
	BTFSC main_1_out,0
	BSF main_1_portb_buf,7
	GOTO	label34
label33
	MOVF main_1_jyotai, W
	XORLW 0x05
	BTFSS STATUS,Z
	GOTO	label34
	MOVF gbl_thresh, W
	SUBWF main_1_ad_result, W
	BTFSS STATUS,C
	CLRF main_1_jyotai
label34
	MOVF main_1_jyotai, F
	BTFSC STATUS,Z
	GOTO	label36
	INCF