#include <p16F1828.inc>
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_ON & _IESO_OFF & _FCMEN_OFF __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF
cblock 0x20
Delay1 ;Define two file registers for the
Delay2 ; delay loop endc
org 0
Start
banksel TRISC
bcf TRISC,0 ; make IO Pin B.0 an output
movlw b'01101010' ;set osc
banksel OSCCON
movwf OSCCON ;configure OSCCON register
MainLoop
bsf PORTC,0 ; turn on LED C0
OndelayLoop
decfsz Delay1,f ; Waste time.
goto OndelayLoop ; The Inner loop takes 3 instructions per loop * 256 loopss = 768 instructions
decfsz Delay2,f ; The outer loop takes and additional 3 instructions per lap * 256 loops
goto OndelayLoop ; (768+3) * 256 = 197376 instructions / 1M instructions per second = 0.197 sec. ; call it a two-tenths of a second.
bcf PORTC,0 ; Turn off LED C0
OffDelayLoop
decfsz Delay1,f ; same delay as above goto OffDelayLoop
decfsz Delay2,f
goto OffDelayLoop
goto MainLoop ; Do it again...
end