;/////////////////////////////////////////////////////////////////////////////////
;// Code Generator: BoostC Compiler - http://www.sourceboost.com
;// Version       : 6.95
;// License Type  : Lite License (Unregistered)
;// Limitations   : PIC12,PIC16 max code size:2048 words, max RAM banks:2, Non commercial use only
;/////////////////////////////////////////////////////////////////////////////////

	include "P16F819.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:64 (0x00000030 - 0x0000006F)
__HEAP_BLOCK1_BANK               EQU	0x00000000
__HEAP_BLOCK1_START_OFFSET       EQU	0x00000030
__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
__div_8_8_00000_arg_a            EQU	0x0000002B ; bytes:1
__div_8_8_00000_arg_b            EQU	0x0000002C ; bytes:1
CompTempVarRet141                EQU	0x0000002F ; bytes:1
__div_8_8_00000_1_r              EQU	0x0000002D ; bytes:1
__div_8_8_00000_1_i              EQU	0x0000002E ; 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_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_adresl                       EQU	0x0000009E ; bytes:1
gbl_adcon1                       EQU	0x0000009F ; 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
delay_26cy_00014_1_c1            EQU	0x0000002C ; bytes:1
delay_100u_00015_1_c1            EQU	0x0000002C ; bytes:1
send_one_9_00016_1_c2            EQU	0x0000002B ; bytes:1
send_zero__00017_1_c2            EQU	0x0000002B ; bytes:1
send_zero__00018_1_c2            EQU	0x0000002B ; bytes:1
delay_0p56_00019_1_c1            EQU	0x0000002B ; bytes:1
send_one_0_0001C_1_c2            EQU	0x0000002B ; bytes:1
main_1_ch                        EQU	0x00000020 ; bytes:1
main_1_send_buf                  EQU	0x00000021 ; bytes:1
main_1_i                         EQU	0x00000022 ; bytes:1
main_1_send_bit                  EQU	0x00000023 ; bytes:1
main_1_div                       EQU	0x00000024 ; bytes:1
main_1_high                      EQU	0x00000025 ; bytes:1
main_1_low                       EQU	0x00000026 ; bytes:1
main_1_plus                      EQU	0x00000027 ; bytes:1
main_1_result                    EQU	0x00000028 ; bytes:1
main_1_num                       EQU	0x00000029 ; bytes:1
main_1_speed                     EQU	0x0000002A ; bytes:1
CompTempVar580                   EQU	0x0000002B ; bytes:1
delay_us_00000_arg_del           EQU	0x0000002B ; bytes:1
delay_ms_00000_arg_del           EQU	0x0000002B ; bytes:1
	ORG 0x00000000
	GOTO	_startup
	ORG 0x00000004
delay_100u_00015
; { delay_100us ; function begin
	MOVLW 0x3F
	BCF STATUS, RP0
	BCF STATUS, RP1
	MOVWF delay_100u_00015_1_c1
label1
	DECFSZ delay_100u_00015_1_c1, F
	GOTO	label1
	RETURN
; } delay_100us function end

	ORG 0x0000000B
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
label2
	NOP
	DECFSZ delay_us_00000_arg_del, F
	GOTO	label2
	RETURN
; } delay_us function end

	ORG 0x00000014
delay_ms_00000
; { delay_ms ; function begin
	MOVF delay_ms_00000_arg_del, F
	BTFSS STATUS,Z
	GOTO	label3
	RETURN
label3
	MOVLW 0xF9
label4
	NOP
	NOP
	NOP
	NOP
	ADDLW 0xFF
	BTFSS STATUS,Z
	GOTO	label4
	NOP
	NOP
	NOP
	NOP
	NOP
	DECFSZ delay_ms_00000_arg_del, F
	GOTO	label3
	RETURN
; } delay_ms function end

	ORG 0x00000028
delay_26cy_00014
; { delay_26cycle ; function begin
	MOVLW 0x07
	BCF STATUS, RP0
	BCF STATUS, RP1
	MOVWF delay_26cy_00014_1_c1
label5
	DECFSZ delay_26cy_00014_1_c1, F
	GOTO	label5
	RETURN
; } delay_26cycle function end

	ORG 0x0000002F
delay_15cy_00013
; { delay_15cycle ; function begin
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	NOP
	RETURN
; } delay_15cycle function end

	ORG 0x0000003D
delay_0p56_00019
; { delay_0p56ms ; function begin
	MOVLW 0xB9
	BCF STATUS, RP0
	BCF STATUS, RP1
	MOVWF delay_0p56_00019_1_c1
label6
	NOP
	NOP
	DECFSZ delay_0p56_00019_1_c1, F
	GOTO	label6
	RETURN
; } delay_0p56ms function end

	ORG 0x00000046
send_zero__0001B
; { send_zero_1p68ms ; function begin
	BCF STATUS, RP0
	BCF STATUS, RP1
	BCF gbl_portb,4
	CALL delay_0p56_00019
	CALL delay_0p56_00019
	CALL delay_0p56_00019
	RETURN
; } send_zero_1p68ms function end

	ORG 0x0000004D
send_zero__0001A
; { send_zero_0p56ms ; function begin
	BCF STATUS, RP0
	BCF STATUS, RP1
	BCF gbl_portb,4
	CALL delay_0p56_00019
	RETURN
; } send_zero_0p56ms function end

	ORG 0x00000052
send_zero__00018
; { send_zero_10ms ; function begin
	BCF STATUS, RP0
	BCF STATUS, RP1
	BCF gbl_portb,4
	MOVLW 0x64
	MOVWF send_zero__00018_1_c2
label7
	CALL delay_100u_00015
	DECF send_zero__00018_1_c2, F
	BTFSS STATUS,Z
	GOTO	label7
	RETURN
; } send_zero_10ms function end

	ORG 0x0000005C
send_zero__00017
; { send_zero_4p5ms ; function begin
	BCF STATUS, RP0
	BCF STATUS, RP1
	BCF gbl_portb,4
	MOVLW 0x2D
	MOVWF send_zero__00017_1_c2
label8
	CALL delay_100u_00015
	DECF send_zero__00017_1_c2, F
	BTFSS STATUS,Z
	GOTO	label8
	RETURN
; } send_zero_4p5ms function end

	ORG 0x00000066
send_one_9_00016
; { send_one_9ms ; function begin
	MOVLW 0xAB
	BCF STATUS, RP0
	BCF STATUS, RP1
	MOVWF send_one_9_00016_1_c2
label9
	BSF gbl_portb,4
	NOP
	CALL delay_15cy_00013
	BCF gbl_portb,4
	NOP
	CALL delay_26cy_00014
	DECF send_one_9_00016_1_c2, F
	BTFSS STATUS,Z
	GOTO	label9
	MOVLW 0xAB
	MOVWF send_one_9_00016_1_c2
label10
	BSF gbl_portb,4
	NOP
	CALL delay_15cy_00013
	BCF gbl_portb,4
	NOP
	CALL delay_26cy_00014
	DECF send_one_9_00016_1_c2, F
	BTFSS STATUS,Z
	GOTO	label10
	RETURN
; } send_one_9ms function end

	ORG 0x0000007F
send_one_0_0001C
; { send_one_0p56ms ; function begin
	MOVLW 0x16
	BCF STATUS, RP0
	BCF STATUS, RP1
	MOVWF send_one_0_0001C_1_c2
label11
	BSF gbl_portb,4
	NOP
	CALL delay_15cy_00013
	BCF gbl_portb,4
	NOP
	CALL delay_26cy_00014
	DECF send_one_0_0001C_1_c2, F
	BTFSS STATUS,Z
	GOTO	label11
	RETURN
; } send_one_0p56ms function end

	ORG 0x0000008D
__div_8_8_00000
; { __div_8_8 ; function begin
	CLRF __div_8_8_00000_1_r
	CLRF CompTempVarRet141
	CLRF __div_8_8_00000_1_i
label12
	BTFSC __div_8_8_00000_1_i,3
	RETURN
	BCF STATUS,C
	RLF CompTempVarRet141, F
	RLF __div_8_8_00000_arg_a, F
	RLF __div_8_8_00000_1_r, F
	MOVF __div_8_8_00000_arg_b, W
	SUBWF __div_8_8_00000_1_r, W
	BTFSS STATUS,C
	GOTO	label13
	MOVWF __div_8_8_00000_1_r
	BSF CompTempVarRet141,0
label13
	INCF __div_8_8_00000_1_i, F
	GOTO	label12
; } __div_8_8 function end

	ORG 0x0000009E
main
; { main ; function begin
	BCF STATUS, RP0
	BCF STATUS, RP1
	CLRF main_1_ch
	MOVLW 0x70
	BSF STATUS, RP0
	MOVWF gbl_osccon
	MOVLW 0xFF
	MOVWF gbl_trisa
	CLRF gbl_trisb
	CLRF gbl_intcon
	MOVLW 0x40
	MOVWF gbl_adcon1
	MOVLW 0x41
	BCF STATUS, RP0
	MOVWF gbl_adcon0
	CLRF gbl_portb
	CLRF main_1_i
label14
	MOVLW 0x02
	SUBWF main_1_i, W
	BTFSC STATUS,C
	GOTO	label15
	BSF gbl_portb,0
	MOVLW 0xC8
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	MOVLW 0x96
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	BCF gbl_portb,0
	MOVLW 0xC8
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	MOVLW 0x96
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	INCF main_1_i, F
	GOTO	label14
label15
	MOVLW 0x99
	MOVWF main_1_high
	MOVLW 0x66
	MOVWF main_1_low
	MOVLW 0x0F
	MOVWF main_1_div
	MOVLW 0x01
	MOVWF main_1_plus
label16
	MOVLW 0x14
	MOVWF delay_us_00000_arg_del
	CALL delay_us_00000
	BSF gbl_adcon0,2
label17
	BTFSC gbl_adcon0,2
	GOTO	label17
	MOVF gbl_adresh, W
	MOVWF main_1_result
	CLRF main_1_speed
	MOVF main_1_result, W
	SUBWF main_1_high, W
	BTFSC STATUS,C
	GOTO	label19
	MOVF main_1_high, W
	SUBWF main_1_result, W
	MOVWF __div_8_8_00000_arg_a
	MOVF main_1_div, W
	MOVWF __div_8_8_00000_arg_b
	CALL __div_8_8_00000
	MOVF CompTempVarRet141, W
	ADDWF main_1_plus, W
	MOVWF main_1_num
	MOVF main_1_num, W
	SUBLW 0x07
	BTFSC STATUS,C
	GOTO	label18
	MOVLW 0x07
	MOVWF main_1_num
label18
	MOVF main_1_num, W
	ADDLW 0x08
	MOVWF main_1_speed
	GOTO	label22
label19
	MOVF main_1_low, W
	SUBWF main_1_result, W
	BTFSC STATUS,C
	GOTO	label21
	MOVF main_1_result, W
	SUBWF main_1_low, W
	MOVWF __div_8_8_00000_arg_a
	MOVF main_1_div, W
	MOVWF __div_8_8_00000_arg_b
	CALL __div_8_8_00000
	MOVF CompTempVarRet141, W
	ADDWF main_1_plus, W
	MOVWF main_1_num
	MOVF main_1_num, W
	SUBLW 0x07
	BTFSC STATUS,C
	GOTO	label20
	MOVLW 0x07
	MOVWF main_1_num
label20
	MOVF main_1_num, W
	SUBLW 0x08
	MOVWF main_1_speed
	GOTO	label22
label21
	MOVLW 0x08
	MOVWF main_1_speed
label22
	BTFSC main_1_speed,3
	BSF gbl_portb,0
	BTFSS main_1_speed,3
	BCF gbl_portb,0
	BTFSC main_1_speed,2
	BSF gbl_portb,1
	BTFSS main_1_speed,2
	BCF gbl_portb,1
	BTFSC main_1_speed,1
	BSF gbl_portb,2
	BTFSS main_1_speed,1
	BCF gbl_portb,2
	BTFSC main_1_speed,0
	BSF gbl_portb,3
	BTFSS main_1_speed,0
	BCF gbl_portb,3
	MOVF main_1_ch, W
	MOVWF main_1_send_buf
	CLRF CompTempVar580
	RLF main_1_send_buf, F
	RLF CompTempVar580, F
	RLF main_1_send_buf, F
	RLF CompTempVar580, F
	RLF main_1_send_buf, F
	RLF CompTempVar580, F
	RLF main_1_send_buf, F
	RLF CompTempVar580, F
	MOVLW 0xF0
	ANDWF main_1_send_buf, F
	MOVF main_1_speed, W
	ADDWF main_1_send_buf, F
	CALL send_one_9_00016
	CALL send_zero__00017
	MOVLW 0x80
	MOVWF main_1_send_bit
	CLRF main_1_i
label23
	MOVLW 0x08
	SUBWF main_1_i, W
	BTFSC STATUS,C
	GOTO	label26
	CALL send_one_0_0001C
	MOVF main_1_send_bit, W
	ANDWF main_1_send_buf, W
	BTFSS STATUS,Z
	GOTO	label24
	CALL send_zero__0001A
	GOTO	label25
label24
	CALL send_zero__0001B
label25
	MOVF main_1_send_bit, F
	BCF STATUS,C
	RRF main_1_send_bit, F
	INCF main_1_i, F
	GOTO	label23
label26
	CALL send_one_0_0001C
	CALL send_zero__00018
	MOVLW 0x1E
	MOVWF delay_ms_00000_arg_del
	CALL delay_ms_00000
	GOTO	label16
; } main function end

	ORG 0x0000013F
_startup
	BCF PCLATH,3
	BCF PCLATH,4
	GOTO	main
	ORG 0x00002007
	DW 0x3F50
	END
