English
Language : 

MC68HC812A4 Datasheet, PDF (210/342 Pages) Motorola, Inc – 16-bit device composed of standard on-chip peripheral modules connected by an intermodule bus. Modules include
Standard Timer Module
12.12.2 Equipment
For this exercise, use the M68HC812A4EVB emulation board.
12.12.3 Code Listing
NOTE:
A comment line is deliminted by a semi-colon. If there is no code before
comment, an “;” must be placed in the first column to avoid assembly
errors.
----------------------------------------------------------------------
;
MAIN PROGRAM
; ----------------------------------------------------------------------
ORG
$7000
; 16K On-Board RAM, User code data area,
;
; start main program at $7000
MAIN:
BSR
TIMERINIT
; Subroutine used to initialize the timer:
;
; Output compare channel, no interrupts
BSR
SQWAVE
; Subroutine to generate square wave
DONE: BRA
DONE
; Branch to itself, Convinient for Breakpoint
;* -----------------------------------------------------------------
;* Subroutine TIMERINIT: Initialize Timer for Output Compare on OC2
;* -----------------------------------------------------------------
TIMERINIT:
CLR
TMSK1
; Disable All Interrupts
MOVB
#$02,TMSK2
; Disable overflow interrupt, disable pull-up
;
; resistor function with normal drive capability
;
; and free running counter, Prescaler = sys clock/4.
MOVB
#$10,TCTL2
; Initialize OC2 to toggle on successful compare.
MOVB
#$04,TIOS
; Select Channel 2 to act as output compare.
MOVW
#$0400,TC2H ; Load TC2 Reg with initial compare value.
MOVB
#$80,TSCR
; Enable Timer, Timer runs during wait state, and
;
; while in Background Mode, also clear flags
;
; normally.
RTS
; Return from Subroutine
MC68HC812A4 — Rev. 3.0
210
Standard Timer Module
Advance Information
MOTOROLA