Wed May 15, 2013 1:54 pm
#include <p18F8720.inc>
ilimit equ 0x20 ; loop index limit
count set 0x00
ii set 0x01 ; loop index
mask equ 0x07 ; used to masked upper five bits
org 0x00
goto start
… ; interrupt service routines
start clrf count,A
movlw ilimit
movwf ii ; initialize ii to ilimit
movlw upper array
movwf TBLPTRU,A
movlw high array
movwf TBLPTRH,A
movlw low array
movwf TBLPTRL,A
movlw mask
i_loop tblrd*+ ; read an array element into TABLAT
andwf TABLAT,F,A
bnz next ; branch if not a multiple of 8
incf count,F,A ; is a multiple of 8
next decfsz ii,F,A ; decrement loop count
bra i_loop
nop
array db 0x00,0x01,0x30,0x03,0x04,0x05,0x06,0x07,0x08,0x09
db 0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13
db 0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D
db 0x1E,0x1F
end
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.