Debian Codegraph @

extras/graphic_lcd/examples/sed1520/glcd_test.asm

raw
1
2 ;; Node test
3 ;;
4 ;; The purpose of this program is to verify that nodes
5 ;; can interconnect I/O pins.
6
7
8 include "processor.inc"
9 include <coff.inc> ; Grab some useful macros
10
11 CONFIG OSC = HSPLL, OSCS = ON, WDT = ON, LVP = OFF
12 CONFIG CP0 = ON, CP1 = ON, CPB = ON
13
14 include "sed1520.inc"
15 include "lcd100X32.inc"
16 include "portdef.inc"
17
18 ;------------------------------------------------------------------------
19 ; gpsim command
20 .command macro x
21 .direct "C", x
22 endm
23
24
25 ;----------------------------------------------------------------------
26 ; Variable declarations
27 ;----------------------------------------------------------------------
28 GPR_DATA UDATA_ACS
29 temp RES 1
30
31
32 temp0 RES 1
33 temp1 RES 1
34 temp2 RES 1
35 temp3 RES 1
36 GLOBAL temp0, temp1, temp2, temp3
37
38
39 Tx RES 1
40 Ty RES 1
41
42 DISPLAY_DATA UDATA 400
43 DisplayBuffer RES 100*4
44 GLOBAL DisplayBuffer
45
46 ;------------------------------------------------------------------------
47 ; Code labels
48
49 GLOBAL done
50
51
52 ;----------------------------------------------------------------------
53 ; ********************* RESET VECTOR LOCATION ********************
54 ;----------------------------------------------------------------------
55 RESET_VECTOR CODE 0x000 ; processor reset vector
56 bra start ; go to beginning of program
57
58 ;----------------------------------------------------------------------
59 ; ******************* INTERRUPT VECTOR LOCATION ******************
60 ;----------------------------------------------------------------------
61
62 INT_VECTOR CODE 0x008 ; interrupt vector location
63 RETFIE 1
64
65 ;----------------------------------------------------------------------
66 ; ******************* MAIN CODE START LOCATION ******************
67 ;----------------------------------------------------------------------
68 MAIN CODE
69 start
70
71 ;;
72 ;; Define the simulation environment.
73 ;;
74
75 .sim "module library libgpsim_extras"
76 .sim "module library libgpsim_modules"
77
78 .sim "module load LCD100X32 LCD"
79 .sim "module load pullup R1"
80 .sim "module load pullup R2"
81
82 .sim "node nE1"
83 .sim "node nE2"
84 .sim "node nRW"
85 .sim "node nA0"
86
87 .sim "attach nE1 porte0 LCD.e1 R1.pin"
88 .sim "attach nE2 porte1 LCD.e2 R2.pin"
89 .sim "attach nRW porte2 LCD.rw"
90 .sim "attach nA0 porta1 LCD.a0"
91
92 .sim "node nd0 nd1 nd2 nd3 nd4 nd5 nd6 nd7"
93
94 .sim "attach nd0 portb0 LCD.d0"
95 .sim "attach nd1 portb1 LCD.d1"
96 .sim "attach nd2 portb2 LCD.d2"
97 .sim "attach nd3 portb3 LCD.d3"
98 .sim "attach nd4 portb4 LCD.d4"
99 .sim "attach nd5 portb5 LCD.d5"
100 .sim "attach nd6 portb6 LCD.d6"
101 .sim "attach nd7 portb7 LCD.d7"
102
103 ;; Now position the modules in the BreadBoard viewer
104
105 .sim "LCD.xpos=192.0"
106 .sim "LCD.ypos=24.0"
107 .sim "R1.xpos=216.0"
108 .sim "R1.ypos=264.0"
109 .sim "R2.xpos=312.0"
110 .sim "R2.ypos=264.0"
111
112 ;; Initialize the SED1520 LCD graphics controller.
113
114 RCALL SED1520_Init
115
116 loop:
117 CLRWDT
118
119 ; Clear Screen Test
120
121 RCALL LCD_ClearScreen
122 RCALL LCD_RefreshDisplay
123
124 ; Line Test
125
126 movlw 31
127 movwf Ty
128 movlw 99
129 movwf Tx
130 LL
131 clrwdt
132 movf Tx,W
133 MOVWF LCD_x2
134 movf Ty,W
135 MOVWF LCD_y2
136 MOVLW 0
137 MOVWF PixelX
138 MOVLW 1
139 MOVWF PixelY
140
141 RCALL LCD_Line
142 ; RCALL LCD_RefreshDisplay
143
144 decf Tx,F
145 BNN LL
146
147 RCALL LCD_RefreshDisplay
148
149 MOVLW 0
150 MOVWF PixelX
151 MOVWF PixelY
152 MOVLW 99
153 MOVWF LCD_x2
154 MOVLW 15
155 MOVWF LCD_y2
156
157 RCALL LCD_Line
158 RCALL LCD_RefreshDisplay
159
160 MOVLW 20
161 MOVWF PixelX
162 CLRF PixelY
163
164 .assert "\"Press run for next test\""
165 nop
166
167 RCALL LCD_ClearScreen
168
169 MOVLW 1
170 RCALL LCD_putBitMap
171 RCALL LCD_RefreshDisplay
172
173 .assert "\"Press run for next test\""
174 nop
175 RCALL LCD_ClearScreen
176
177 CLRF PixelX
178 MOVLW 0
179 RCALL LCD_putBitMap
180 RCALL LCD_RefreshDisplay
181
182
183
184 MOVLW 32
185 MOVWF PixelX
186
187 MOVLW 2
188 RCALL LCD_putBitMap
189 RCALL LCD_RefreshDisplay
190
191 .assert "\"Press run to repeat test\""
192 nop
193 bra loop
194
195 nop
196
197 done:
198
199 .assert "\"*** PASSED LCD test\""
200 goto $
201
202 FAILED:
203 .assert "\"*** FAILED LCD test\""
204 goto $
205
206
207
208 end