
_main:

;LED_PWM.mbas,10 :: 		main:
;LED_PWM.mbas,11 :: 		OSCCON = %01110000                    '8MHz
	MOVLW       112
	MOVWF       OSCCON+0 
;LED_PWM.mbas,12 :: 		PLLEn_bit = 1                         'Enable PLL (now 48MHz)
	BSF         PLLEN_bit+0, BitPos(PLLEN_bit+0) 
;LED_PWM.mbas,13 :: 		TRISC2_bit = 0                        'Make PortC.2 an output
	BCF         TRISC2_bit+0, BitPos(TRISC2_bit+0) 
;LED_PWM.mbas,14 :: 		LATC2_bit = 0                         'Default LED to off
	BCF         LATC2_bit+0, BitPos(LATC2_bit+0) 
;LED_PWM.mbas,15 :: 		i = MinBright
	MOVLW       1
	MOVWF       _i+0 
;LED_PWM.mbas,16 :: 		direction = 0
	BCF         _direction+0, BitPos(_direction+0) 
;LED_PWM.mbas,17 :: 		PPS_Mapping(13, _OUTPUT, _CCP1_P1A)   'Assign CCP1 to RP13
	MOVLW       13
	MOVWF       FARG_PPS_Mapping_rp_num+0 
	CLRF        FARG_PPS_Mapping_input_output+0 
	MOVLW       14
	MOVWF       FARG_PPS_Mapping_funct_name+0 
	CALL        _PPS_Mapping+0, 0
;LED_PWM.mbas,18 :: 		PWM1_Init(5000)                       'Initialise PWM at 5kHz
	BCF         T2CON+0, 0, 0
	BCF         T2CON+0, 1, 0
	BSF         T2CON+0, 0, 0
	BSF         T2CON+0, 1, 0
	MOVLW       149
	MOVWF       PR2+0, 0
	CALL        _PWM1_Init+0, 0
;LED_PWM.mbas,19 :: 		PWM1_Start()
	CALL        _PWM1_Start+0, 0
;LED_PWM.mbas,20 :: 		while (1)
L__main2:
;LED_PWM.mbas,22 :: 		PWM1_Set_Duty(i)
	MOVF        _i+0, 0 
	MOVWF       FARG_PWM1_Set_Duty_new_duty+0 
	CALL        _PWM1_Set_Duty+0, 0
;LED_PWM.mbas,23 :: 		delay_ms(GlowSlow)
	MOVLW       32
	MOVWF       R12, 0
	MOVLW       41
	MOVWF       R13, 0
L__main6:
	DECFSZ      R13, 1, 1
	BRA         L__main6
	DECFSZ      R12, 1, 1
	BRA         L__main6
	NOP
	NOP
;LED_PWM.mbas,25 :: 		if direction = 0 then
	BTFSC       _direction+0, BitPos(_direction+0) 
	GOTO        L__main8
;LED_PWM.mbas,26 :: 		Inc(i)
	INCF        _i+0, 1 
	GOTO        L__main9
;LED_PWM.mbas,27 :: 		else
L__main8:
;LED_PWM.mbas,28 :: 		Dec(i)
	DECF        _i+0, 1 
;LED_PWM.mbas,29 :: 		end if
L__main9:
;LED_PWM.mbas,31 :: 		if i = MaxBright then
	MOVF        _i+0, 0 
	XORLW       200
	BTFSS       STATUS+0, 2 
	GOTO        L__main11
;LED_PWM.mbas,32 :: 		direction = 1 'Count down
	BSF         _direction+0, BitPos(_direction+0) 
L__main11:
;LED_PWM.mbas,34 :: 		if i = MinBright then
	MOVF        _i+0, 0 
	XORLW       1
	BTFSS       STATUS+0, 2 
	GOTO        L__main14
;LED_PWM.mbas,35 :: 		direction = 0 'Count up
	BCF         _direction+0, BitPos(_direction+0) 
;LED_PWM.mbas,37 :: 		PWM1_Stop()
	CALL        _PWM1_Stop+0, 0
;LED_PWM.mbas,38 :: 		delay_ms(1000)
	MOVLW       61
	MOVWF       R11, 0
	MOVLW       225
	MOVWF       R12, 0
	MOVLW       63
	MOVWF       R13, 0
L__main16:
	DECFSZ      R13, 1, 1
	BRA         L__main16
	DECFSZ      R12, 1, 1
	BRA         L__main16
	DECFSZ      R11, 1, 1
	BRA         L__main16
	NOP
	NOP
;LED_PWM.mbas,39 :: 		PWM1_Start()
	CALL        _PWM1_Start+0, 0
L__main14:
;LED_PWM.mbas,41 :: 		wend
	GOTO        L__main2
L_end_main:
	GOTO        $+0
; end of _main
