blinking LEDs with PIC16LF1829 with frequency of 1 second in Assembly Code
The posted code is failing because the writes to OSCCON change the DACCON1 register in BANK2, the bank where the LATC register is located.

To correct this problem change your code to select BANK1 before updating to the OSCCON register.

I think this code should work as you intended:


#include &lt;p16f1829.inc&gt;
 __CONFIG _CONFIG1, (_FOSC_INTOSC &amp; _WDTE_OFF &amp; _PWRTE_OFF &amp; _MCLRE_OFF &amp; _CP_OFF &amp; _CPD_OFF &amp; _BOREN_ON &amp; _CLKOUTEN_OFF &amp; _IESO_OFF &amp; _FCMEN_OFF);
 __CONFIG _CONFIG2, (_WRT_OFF &amp; _PLLEN_OFF &amp; _STVREN_OFF &amp; _LVP_OFF);
    ORG     0
    errorlevel -302     ; suppress the 'not in bank0' warning
    cblock  0x70
      Delay1
      Delay2
      Count
    endc

Start:
    banksel OSCCON      ; Select bank1
    movlw   0x5A        ; running at 1MHz
;   movlw   b'00111000' ; set CPU clock speed
    movwf   OSCCON      ; set the clock frequency of 2MHz
    bcf     TRISC,0
    bcf     TRISC,1
    bcf     TRISC,2
    bcf     TRISC,3
    banksel LATC        ; Select bank2
    clrf    LATC        ; set all the LEDs off
Timelag1:
    banksel OSCCON      ; Select bank1
    movlw   0x5A
    movwf   OSCCON
    decfsz  Dleay1,F
    bra     Timelag1
    decfsz  Dleay2,F
    bra     Timelag1
Timelag2:
    banksel OSCCON      ; Select bank1
    movlw   0x6A        ; 4M
    movwf   OSCCON
    decfsz  Dleay1,F
    bra     Timelag2
    decfsz  Dleay2,F
    bra     Timelag2
Main:
    banksel LATC        ; Select bank2
    bsf     LATC,0      ; turn on the LED-0,with 4MHz
    bcf     LATC,1
    bcf     LATC,2
    bcf     LATC,3
    decfsz  Dleay1,F
    bra     Main
    decfsz  Dleay2,F
    bra     Main
Main_1:
    banksel OSCCON      ; Select bank1
    movlw   0x5A        ; 1M
    movwf   OSCCON
    decfsz  Dleay1,F    ; prolong the time with another 1MHz
    bra     Main_1
    decfsz  Dleay2,F
    bra     Main_1
    end