定时计数器源代码

include HT46R64.inc

ds .section 'data'

 counter db  ?


cs .section 'code'

   org 000h
   jmp begin
   org 00ch
   jmp t0_isr
   org 020h
  
begin:
    set  pd
    clr  pdc
    ;mov  a,10000000b
    ;mov  tmr0c,a
    set  t0psc2
    set  t0psc1
    set  t0psc0
    set  t0m1
    clr  t0m0
   
    clr  tmr0
    set  et0i
    set  emi
    set  t0on
  
    mov  a,61
    mov  counter,a
    jmp  $
  
t0_isr:

    sdz  counter
    jmp  t0_ret
   
     mov  a,1
     xorm a,pd
     mov  a,61
     mov  counter,a
t0_ret:
      reti
            end

你可能感兴趣的:(定时计数器源代码)