LIST p=16F88 ;tell assembler what chip we are using
include "P16F88.inc" ;include the defaults for the chip
__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF
cblock 0x20 ;start of general purpose registers
d1
d2
d3
count
endc
ORG 0x0000 ; processor reset vector
GOTO init ; go to beginning of program
init:
banksel OSCCON
movlw b'01110010'
movwf OSCCON
RESET clrf STATUS ; |B0
clrf PORTA ; clear Port A data latches |B0
clrf PORTB ; clear Port B data latches |B0
movlw h'07' ; |B0
movwf CMCON ; turn comparator off |B0
goto Start
Start clrf count ;set counter register to zero
Read movf count, w ;put counter value in W
call Table
movwf PORTB
call delay
incf count, w
xorlw d'14' ;check for last (14th) entry
btfsc STATUS, Z
goto Start ;if start from beginning
incf count, f ;else do next
goto Read
Table ADDWF PCL, f ;data table for bit pattern
retlw b'10000000'
retlw b'01000000'
retlw b'00100000'
retlw b'00010000'
retlw b'00001000'
retlw b'00000100'
retlw b'00000010'
retlw b'00000001'
retlw b'00000010'
retlw b'00000100'
retlw b'00001000'
retlw b'00010000'
retlw b'00100000'
retlw b'01000000'
delay ;249998 cycles
movlw 0x4F
movwf d1
movlw 0xC4
movwf d2
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;6 cycles
goto $+1
goto $+1
goto $+1
retlw 0x00
end