Working on this below program, but what I need help with is the part of the code the have it displayed on the FOX11/MC68HC11 LCD. What type of algorithm do I need to have the display/show the actual clock? Is it another timer subroutine or is it a display subroutine.. need some instructions or guidance to put me in the right direction to finish my code.
Code ASM - [expand ] 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
org 0 ; start address of data
hr rmb 1 ; hour counts in bcd
min rmb 1 ; minutes count bcd
second rmb 1 ; second count bcd
fsec rmb 2 ; fraction of second count for rti routine
fcnt equ 244 ; number of rtii interrupts to make 1 second
*
tmsk2: equ $ 24 ;main timer interrupt mask reg 2
tflg2: equ $ 25 ;main timer interrupt flag reg 2
*
TEN_MS: equ 2500
STACK : equ $ 8FFF
*
REGBAS: equ $ 1000
*
JSCI RMB 3 ;reserve memeory bytes
JSPI RMB 3 ;reserve memeory bytes
JPAIE RMB 3 ;reserve memeory bytes
JPAO RMB 3 ;reserve memeory bytes
JTOF RMB 3 ;reserve memeory bytes
JTOC5 RMB 3 ;reserve memeory bytes
JTOC4 RMB 3 ;reserve memeory bytes
JTOC3 RMB 3 ;reserve memeory bytes
JTOC2 RMB 3 ;reserve memeory bytes
JTOC1 RMB 3 ;reserve memeory bytes
JTIC3 RMB 3 ;reserve memeory bytes
JTIC2 RMB 3 ;reserve memeory bytes
JTIC1 RMB 3 ;reserve memeory bytes
JRTI RMB 3 ;reserve memeory bytes
JIRQ RMB 3 ;reserve memeory bytes
JXIRQ RMB 3 ;reserve memeory bytes
JSWI RMB 3 ;reserve memeory bytes
JILLOP RMB 3 ;reserve memeory bytes
JCOP RMB 3 ;reserve memeory bytes
JCLM RMB 3 ;reserve memeory bytes
*
org $ FF70
lcd_ini: rmb 3 ; initializes 16x2 LCD module
lcd_line1: rmb 3 ; displays 16 char on the first line
org $ D000
jmp start
*
delay_10ms:
pshx
ldx #TEN_MS ; 2500 x 8 = 20,000 cycles = 10ms
del1: dex ; 3 cycles
nop ; 2 cycle
bne del1 ; 3 cycles
pulx
rts
*
start : lds #STACK
jsr delay_10ms ; delay 20ms during power up
jsr delay_10ms
jsr lcd_ini ; initialize LCD
back: ldx #MSG1 ; MSG1 for line1, x points to MSG1
jsr lcd_line1
swi ; go back to BUFFALO monitor
*
org $ 180
*
pactl: equ $ 26
REGBLK: equ $ 1000
lds #STACK ;load stack pointer
ldx #REGBLK ;load index reg x
ldaa pactl, x ;load adda
anda #$ FC ;set bits(RTR1, RTR0) pf PACTLstaa PACTL
staa pactl, x ;store pactl, x acca
BSET tmsk2, X $ 40 ;set bit
cli ;clear interrup mask
*
* subroutine intitrtii
* RAM variables
* HR = hour count
* MIN = minute count
* SEC = second count
* calling registers
* IX = register block address
initrtii
bset tmsk2, x $ 40 ; set rtii flag
cli
clr fsec ; initialize fsec
clr fsec+ 1
rts ; return
* service routine rrtii
* handles real time interrupt
* uses 16 bit software counter FSEC to count fractions
* of seconds. Update RAM variables second, minutes and
* hours as BCD values fpr use by any other routine.
rrtii
ldx #regbas ; base address of I/O reg block
ldaa #$ 40 ; clear rtif
staa tflg2, x
ldy fsec ; count # of rtii
iny ; occurrences
sty fsec
cpy #fcnt ; add 1 to sec if
beq seconds ;enough occurred
seconds
clr fsec ;reset fraction sec count
clr fsec+ 1 ;to zero
ldaa second
adda #1 ; add 1 to second count
daa ;adjust for decimal arithmetic
cmpa #$ 60 ;check for seconds = = 60
beq minutes ; adjust minutes if = = 60
staa second
rti
minutes
clr second ;reset sec to zero
ldaa min
adda #1 ; add 1 to minute count
daa ;adjust for decimal arithmetic
cmpa #$ 60 ;check for minutes = = 60
beq hours ; adjust hours if = = 60
staa min
rti
hours
clr min ;reset min to zero
ldaa hr
adda #1 ; add 1 to hour count
daa ;adjust for decimal arithmetic
staa hr
cmpa #$ 24 ;check for minutes = = 24
bne return ; reset to 0 if = = 24
return
rti
MSG1: FCC "00:00:00"
Last edited by a moderator: Aug 15, 2013