-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.inc
99 lines (83 loc) · 1.22 KB
/
display.inc
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
CheckLeadingZero macro Digit
movf (Display+Digit),w
xorlw 0xDD
btfss STATUS, Z
return
clrf (Display+Digit)
endm
UpdateDisplay
incf DisplayLoop, f
movlw 5
xorwf DisplayLoop, w
btfsc STATUS, Z
clrf DisplayLoop
movfw DisplayLoop
TableLookup
goto DisplayDigit0
goto DisplayDigit1
goto DisplayDigit2
goto DisplayDigit3
goto ReadButtons
DisplayDigit0
ShowDigit Display+0 , 0
return;
DisplayDigit1
ShowDigit Display+1 , 1
return;
DisplayDigit2
ShowDigit Display+2 , 2
return;
DisplayDigit3
ShowDigit Display+3 , 3
return;
DisplayTime
movwf FSR
incf FSR,f
incf FSR,f
movfw INDF
decf FSR, f
iorwf INDF, w
movwf Temp
btfsc STATUS, Z
decf FSR, f
BD7Seg Display, INDF
incf FSR, f
BD7Seg Display2, INDF
movf Temp, w
btfsc STATUS, Z
bsf Display+2, 1
CheckLeadingZero 3
CheckLeadingZero 2
CheckLeadingZero 1
return
DisplayRaw macro Text
variable I
I = 0
while (I < 4)
J = 3 - I
call Text+I
movwf Display + J
I++
endw
endm
DisplayText macro TEXT, LEN
variable I
variable J
I = 0
while (I < LEN)
J = +3 - I
call TEXT+I
call ToSevenSegLET
movwf Display + J
I++
endw
if ( LEN < 4)
I = LEN
clrw
while ( I < 4 )
J = +3 - I
movwf Display + J
I++
endw
endif
endm