
_main:

;LED_PWM.mpas,10 :: 		begin
;LED_PWM.mpas,11 :: 		OSCCON := %01110000;                    //8MHz
	MOVLW       112
	MOVWF       OSCCON+0 
;LED_PWM.mpas,12 :: 		PLLEn_bit := 1;                         //Enable PLL (now 48MHz)
	BSF         PLLEN_bit+0, 6 
;LED_PWM.mpas,13 :: 		TRISC2_bit := 0;                        //Make PortC.2 an output
	BCF         TRISC2_bit+0, 2 
;LED_PWM.mpas,14 :: 		LATC2_bit := 0;                         //Default LED to off
	BCF         LATC2_bit+0, 2 
;LED_PWM.mpas,15 :: 		i := MinBright;
	MOVLW       1
	MOVWF       _i+0 
;LED_PWM.mpas,16 :: 		dir := 0;
	BCF         _dir+0, BitPos(_dir+0) 
;LED_PWM.mpas,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.mpas,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.mpas,19 :: 		PWM1_Start();
	CALL        _PWM1_Start+0, 0
;LED_PWM.mpas,20 :: 		while (1) do begin
L__main2:
;LED_PWM.mpas,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.mpas,23 :: 		delay_ms(GlowSlow);
	MOVLW       110
	MOVWF       R12, 0
	MOVLW       21
	MOVWF       R13, 0
L__main6:
	DECFSZ      R13, 1, 1
	BRA         L__main6
	DECFSZ      R12, 1, 1
	BRA         L__main6
	NOP
	NOP
;LED_PWM.mpas,25 :: 		if dir = 0 then
	BTFSC       _dir+0, BitPos(_dir+0) 
	GOTO        L__main8
;LED_PWM.mpas,26 :: 		Inc(i)
	INCF        _i+0, 1 
	GOTO        L__main9
;LED_PWM.mpas,27 :: 		else
L__main8:
;LED_PWM.mpas,28 :: 		Dec(i);
	DECF        _i+0, 1 
L__main9:
;LED_PWM.mpas,31 :: 		if i = MaxBright then begin
	MOVF        _i+0, 0 
	XORLW       50
	BTFSS       STATUS+0, 2 
	GOTO        L__main11
;LED_PWM.mpas,32 :: 		dir := 1; //Count down
	BSF         _dir+0, BitPos(_dir+0) 
;LED_PWM.mpas,33 :: 		end;
L__main11:
;LED_PWM.mpas,34 :: 		if i = MinBright then begin
	MOVF        _i+0, 0 
	XORLW       1
	BTFSS       STATUS+0, 2 
	GOTO        L__main14
;LED_PWM.mpas,35 :: 		dir := 0; //Count up
	BCF         _dir+0, BitPos(_dir+0) 
;LED_PWM.mpas,37 :: 		PWM1_Stop();
	CALL        _PWM1_Stop+0, 0
;LED_PWM.mpas,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.mpas,39 :: 		PWM1_Start();
	CALL        _PWM1_Start+0, 0
;LED_PWM.mpas,40 :: 		end;
L__main14:
;LED_PWM.mpas,41 :: 		end;
	GOTO        L__main2
;LED_PWM.mpas,42 :: 		end.
L_end_main:
	GOTO        $+0
; end of _main
