list p=12LF1552 ; Define the target microcontroller #include ; Include the device-specific header file CONFIG FOSC=INTOSC, WDTE=OFF, PWRTE=OFF, MCLRE=OFF, CP=OFF, BOREN=OFF, CLKOUTEN=OFF ; Define constants LED_PIN equ 0 ; RA0 is used to control the LED ; Define memory locations count1 equ 0x20 ; Memory location for the delay count (LSB) count2 equ 0x21 ; Memory location for the delay count (MSB) ; Program starts at address 0x0000 org 0x0000 ; Main program starts here main: ; Set up the I/O pins banksel TRISA ; Select the TRISA register bank bcf TRISA,LED_PIN ; Set the LED pin as an output banksel PORTA ; Select the PORTA register bank loop: ; Loop forever bsf PORTA,LED_PIN ; Turn on the LED call delay ; Wait for a while bcf PORTA,LED_PIN ; Turn off the LED call delay ; Wait for a while goto loop ; Repeat indefinitely ; Delay subroutine delay: movlw 25 ; Load the delay value in seconds movwf count1 ; Store the delay value (MSB) delay1: movlw 254 ; Load the delay value (LSB) movwf count2 ; Store the delay value (LSB) delay_loop2: decfsz count2,f ; Decrement the MSB register and skip if zero goto delay_loop2 ; Repeat the delay loop if the MSB register is not zero delay_loop1: decfsz count1,f ; Decrement the LSB register and skip if zero goto delay1 ; Repeat the delay loop if the LSB register is not zero return ; Return from the subroutine end ; End of program