HT47 Timer Application

Publisher:chenxiaohong68Latest update time:2018-01-26 Source: eefocusKeywords:HT47  Timer Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

HT47 Timer Application

include ht47c20.inc
data .section 'data'
int_count db ?
io_count db ?
code .section at 0 'code'
 org 00h
 jmp start
 org 04h
 reti
 org 08h



 reti
 org 0ch
 reti
 org 10h
 jmp timer_int
;---------------------------------
 org 20h
start:
 clr iNTC0
 clr intc1
 clr adcr.1
 set tmrc.5   ;系统时钟
  MOV a,0ah
  MOV int_count,a
 clr io_count
  MOV a,LOW(65536-12000) ;0.1秒产生中断
  MOV tmral,a
  MOV tmrbl,a
  MOV a,HIGH(65536-12000)
  MOV tmrah,a
  MOV tmrbh,a
 set tmrc.4
 set intc1.0
 set intc0.0
 jmp $
;---------------------------------
timer_int:
 sdz int_count
 reti
 inc io_count
 swapa io_count
 cpl aCC
  MOV pa,a
  MOV a,0ah
  MOV int_count,a
 reti
;*************************************************


;*************************************************

include ht47c20.inc
data .section 'data'
count db ?
code .section at 0 'code'
 org 00h
 jmp start
 org 04h
 reti
 org 08h
 reti
 org 0ch
 reti
 org 10h
 jmp timer_int
;---------------------------------
start: clr intc0
 clr intc1
 clr adcr.1 ;Timer/counter enable
 set tmrc.7 ;Count external clock
 clr count
  MOV a,LOW(65536-1000);Timer/counter initial value 
  MOV tmral,a
  MOV tmrbl,a
  MOV a,HIGH(65536-1000)
  MOV tmrah,a
  MOV tmrbh,a
 set tmrc.4 ;Turn on timer/counter
 set intc1.0 ;Timer/counter interrupt enable
 set intc0.0 ;Total interrupt enable
 jmp $
;---------------------------------
timer_int:
 inc count
 swapa count
 cpl acc
  MOV pa,a
 reti
;************************************************

;************************************************

include ht47c20.inc
data .section 'data'
count db ?

code .section at 0 'code'
 org 00h
 jmp start
 org 04h
 reti
 org 08h
 reti
 org 0ch
 reti
 org 10h
 jmp timer_int
;---------------------------------
start: clr intc0
 clr intc1
 clr adcr.1
 set tmrc.5
 set tmrc.7
 clr count
  MOV a,LOW(65536-60000)
  MOV tmral,a
  MOV tmrbl,a
  MOV a,HIGH(65536-60000)
  MOV tmrah,a
  MOV tmrbh,a
 set tmrc.4
 set intc1.0
 set intc0.0
 jmp $
;---------------------------------
timer_int:
 inc count
 swapa count
 cpl acc
  MOV pa,a
 reti
;*********************************************


Keywords:HT47  Timer Reference address:HT47 Timer Application

Previous article:HT47 Real Time Clock (RCT) Application
Next article:HT47I_O Port Application

Recommended ReadingLatest update time:2024-11-16 17:33

Application of MSP430 MCU TIMER_A in product design
Timer A (TIMER_A) has 4 working modes: stop, rise, continuous, rise and fall. The rise and rise and fall modes need to be used together with the compare/capture channel 0 (CCR0). We can flexibly choose according to actual needs. When multiple capture/compare channels use 16-bit timing as the time scale, the TIMER_A tim
[Microcontroller]
LPC2103 timer0 and timer1
 Timer/Counter Timer0 and Timer1          Page187              The timer/counter is programmed to count cycles under the peripheral clock (PCLK) or the externally provided clock. It can selectively generate an interrupt or perform other operations after the specified timing value is reached based on four match regi
[Microcontroller]
MSP430F5529 (VI) Timer_A-2
6.4 Capture Compare Module This is the official introduction to the important functions of TA based on the above introduction. First, let's look at a register TACCTL0-TACCTL6: (The most complex register in TA, look up the table when used) CMx: Capture mode setting 00 No capture  01 Rising edge capture  10 Fall
[Microcontroller]
MSP430F5529 (VI) Timer_A-2
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号