list p=16f88
#include <pic16f88.inc>
osccon equ 8fh
status equ 03h
porta equ 05h
portb equ 06h
ansel equ 9bh
trisa equ 85h
trisb equ 86h
cblock 20h
d1
d2
d3
endc
org 0x000
main ;initialisiing ports and clock
;********setting the internal RC clock frequency
call banksel1
movlw 01101110 ;freq = 4MHz, bit 1 and 0 are 10 because internal RC is used for the system clock
movwf osccon
clrf ansel ;setting all pins to digital pins
clrf trisa ;setting all port A into output
clrf trisb ;setting all port B into output
call banksel0
clrf porta;set all port A into LOW
clrf portb;set all port B into LOW
mainloop ;the main loop
bsf porta,0 ;set pin 17 HIGH
call delay1.5ms
bcf porta,0 ;set pin 17 LOW
call delay18.5ms
goto mainloop
;***bank selections***
banksel0
bcf status,5
bcf status,6
return
banksel1
bsf status,5
bcf status,6
return
;***delay routine***
;*delay variables
delay1.5ms ;total of 1,500,004 cycles
movlw odh
movwf d1
movlw 46h
movwf d2
movlw 04h
movwf d3
goto delay
return
delay18.5ms ;total of 18,500,003 cycles
movlw a8h
movwf d1
movlw 54h
movwf d2
movlw 29h
movwf d3
goto delay
return
;*actual delay routine
delay
decfsz d1,f
goto $+2
decfsz d2,f
goto $+2
decfsz d3,f
goto delay
return