HT45R37
Programming Example
The following example shows the principles of how the C/R to F converter function is programmed:
External RC oscillation converter mode example program - Timer A overflow:
clr RCOCCR
mov a, 00000010b
mov RCOCR,a
clr mfic0.1
; Enable External RC oscillation mode and set Timer A overflow
; Clear External RC Oscillation Converter interrupt request flag
clr mfic0.5
mov a, low (65536-1000)
mov tmral, a
mov a, high (65536-1000)
mov tmrah, a
mov a, 00h
; Give timer A initial value
; Timer A count 1000 time and then overflow
; Give timer B initial value
mov tmrbl, a
mov a, 00h
mov tmrbh, a
mov a, 00110000b
mov RCOCCR, a
p10:
; Timer A clock source=fSYS/4 and timer on
; Polling External RC Oscillation Converter interrupt request flag
clr wdt
snz mfic0.5
jmp p10
clr mfic0.5
; Clear External RC Oscillation Converter interrupt request flag
; Program continue
Rev. 1.20
30
February 25, 2011