English
Language : 

MC68HC812A4 Datasheet, PDF (211/342 Pages) Motorola, Inc – 16-bit device composed of standard on-chip peripheral modules connected by an intermodule bus. Modules include
Standard Timer Module
Using the Output Compare Function to Generate a Square Wave
;* ------------------------------
;*
SUBROUTINE: SQWAVE
;* ------------------------------
SQWAVE:
;* -------
CLEARFLG:
;* -------
;* To clear the C2F flag: 1) read TFLG1 when
;* C2F is set and then 2) write a logic "one" to C2F.
LDAA
ORAA
STAA
TFLG1
#$04
TFLG1
; To clear OC2 Flag, first it must be read,
; then a "1" must be written to it
WTFLG: BRCLR TFLG1,#$04,WTFLG ; Wait (Polling) for C2F Flag
LDD
ADDD
STD
TC2H
#$0400
TC2H
; Loads value of compare from TC2 Reg.
; Add hex value of 500us High Time
; Set-up next transition time in 500 us
BRA
CLEARFLG
; Continuously add 500 us, branch to CLEARFLAG
RTS
; return from Subroutine
END
; End of program
Advance Information
MOTOROLA
Standard Timer Module
MC68HC812A4 — Rev. 3.0
211