[SOLVED] 68HC11 Digital Clock Source Code (Need Help)

Status
Not open for further replies.

cturbo

Newbie level 2
Joined
Aug 13, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
47
68HC11/FOX11 board Digital Clock Source Code (Need Help)

I need help, to write a source code for the FOX11 board and Micocontroller 68HC11; to use the LCD on the actual FOX11 board to display a digital clock. There is no external components. Below is what I have and what i need is to add the part to have it correctly show on the LCD. I am not proficient enough to get this to work and need help. If this code is not workable please advise. Thank you



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
org        0    ; start address of data
hr      rmb     1       ;hour counts in bcd
min     rmb     1       ;minutes count bcd
sec     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
*
        org     $180
*subroutine intitrtii
 
initrtii
 
 
        bset    tmsk2, x $40    ; set rtii flag
        cli
                clr     fsec            ; initialize fsec
                clr     fsec+1
        rts                     ; return
*service routine rrtii
rrti
        ldx      #regbas
        ldaa    #$40            ; clear rtif
        staa    tflg2, x
        ldy     fsec            ; count # of rtii
               iny                      ;occurrences
          sty   fsec
        cpy     #fcnt           ; add 1 to sec if
            beq second          ;enough occurred
seconds
        clr     fsec            ;reset fraction sec count
        clr     fsec+1          ;to zero
        ldaa    sec
        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     sec
               rti
minutes 
                clr     sec             ;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 hours = = 24
               bne      return            ;reset to 0 if = = 24
return
              rti

 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…