;define variable var_base 0x20 counter_addr var_base;define macro counter16_init macro __counter_addr clrf __counter_addr clrf __counter_addr+1endmcounter16_count macro __counter_addr__counter_main: incf __counter_addr btfsc status, z__increase_highbyte: incf __counter_addr+1__increase_lowbyte: org 0 goto main org 4 goto int_srv int_srv: goto main main: counter16_init counter_addrto_count: counter16_count counter_addr goto to_count
;define variable
ReplyDeletevar_base 0x20
counter_addr var_base
;define macro
counter16_init macro __counter_addr
clrf __counter_addr
clrf __counter_addr+1
endm
counter16_count macro __counter_addr
__counter_main:
incf __counter_addr
btfsc status, z
__increase_highbyte:
incf __counter_addr+1
__increase_lowbyte:
org 0
goto main
org 4
goto int_srv
int_srv:
goto main
main:
counter16_init counter_addr
to_count:
counter16_count counter_addr
goto to_count