Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 123:6a94f96e9cea
The big cleanup, again.
author | JeanDo |
---|---|
date | Thu, 30 Dec 2010 23:45:20 +0100 |
parents | 3e351e25f5d1 |
children | 06c4899ddb4b |
comparison
equal
deleted
inserted
replaced
122:3003a8040b78 | 123:6a94f96e9cea |
---|---|
45 WIN_COLOR macro win_color_input | 45 WIN_COLOR macro win_color_input |
46 movlw win_color_input | 46 movlw win_color_input |
47 call PLED_set_color | 47 call PLED_set_color |
48 endm | 48 endm |
49 | 49 |
50 | |
51 word_processor: ; word_processor: | 50 word_processor: ; word_processor: |
52 clrf POSTINC2 ; Required! | 51 clrf POSTINC2 ; Required, to mark end of string. |
53 | |
54 ifdef AAFONTS | |
55 call aa_wordprocessor | 52 call aa_wordprocessor |
56 movlb b'00000001' ; Back to Rambank1 | 53 movlb b'00000001' ; Back to Rambank1 |
57 else | |
58 movff win_color2,win_color2_temp | |
59 movff win_color1,win_color1_temp | |
60 call main_wordprocessor ; C-Code | |
61 movlb b'00000001' ; Back to Rambank1 | |
62 movff win_color2_temp,win_color2 | |
63 movff win_color1_temp,win_color1 | |
64 endif | |
65 | |
66 return | 54 return |
67 | 55 |
68 ; ----------------------------- | 56 ; ----------------------------- |
69 ; PLED_SetColumnPixel: | 57 ; PLED_SetColumnPixel: |
70 ; ----------------------------- | 58 ; ----------------------------- |
71 PLED_SetColumnPixel: | 59 PLED_SetColumnPixel: |
72 movwf LastSetColumn ; d'0' ... d'159' | 60 movwf win_leftx2 ; d'0' ... d'159' |
73 movff LastSetColumn,win_leftx2 | 61 mullw 2 ; Copy to POD, times 2. |
62 | |
74 movlw 0x21 ; Start Address Vertical (.0 - .319) | 63 movlw 0x21 ; Start Address Vertical (.0 - .319) |
75 rcall PLED_CmdWrite | 64 rcall PLED_CmdWrite |
76 bcf STATUS,C | 65 bra PLED_DataWrite_PROD |
77 rlcf LastSetColumn,W ; x2 -> WREG | |
78 movlw d'0' | |
79 btfsc STATUS,C ; Result >255? | |
80 movlw d'1' ; Yes: Upper=1! | |
81 rcall PLED_DatWrite ; Upper | |
82 bcf STATUS,C | |
83 rlcf LastSetColumn,W ; x2 -> WREG | |
84 rcall PLED_DatWrite ; Lower | |
85 return | |
86 | 66 |
87 ; ----------------------------- | 67 ; ----------------------------- |
88 ; PLED_SetRow: | 68 ; PLED_SetRow: |
69 ; Backup WREG --> win_top, for the next write pixel. | |
70 ; Setup OLED pixel horizontal address. | |
89 ; ----------------------------- | 71 ; ----------------------------- |
90 PLED_SetRow: | 72 PLED_SetRow: |
91 movwf LastSetRow ; d'0' ... d'239' | 73 movff WREG,win_top ; d'0' ... d'239' |
92 movff LastSetRow,win_top | 74 mullw 1 ; Copy row to PRODH:L |
93 movlw 0x20 ; Horizontal Address START:END | 75 movlw 0x20 ; Horizontal Address START:END |
94 rcall PLED_CmdWrite | 76 rcall PLED_CmdWrite |
95 movlw 0x00 | 77 bra PLED_DataWrite_PROD |
96 rcall PLED_DatWrite | |
97 movf LastSetRow,W | |
98 rcall PLED_DatWrite | |
99 return | |
100 | 78 |
101 ; ----------------------------- | 79 ; ----------------------------- |
102 ; PLED Write Two Pixel | 80 ; PLED Write Two Pixel |
103 ; ----------------------------- | 81 ; ----------------------------- |
82 | |
104 PLED_PxlWrite: | 83 PLED_PxlWrite: |
105 movlw 0x22 ; Start Writing Data to GRAM | 84 rcall PLED_PxlWrite_Single ; Write first pixel. |
106 rcall PLED_CmdWrite | 85 |
107 bsf oled_rs ; Data! | 86 ; Write 2nd Pixel on same row but one column to the right |
108 movff win_color1,PORTD | 87 movwf win_leftx2,W ; Increment column address. |
109 bcf oled_rw | 88 mullw 2 |
110 bsf oled_rw ; Upper | 89 incf PRODL |
111 movff win_color2,PORTD | 90 clrf WREG ; Does not reset CARRY... |
112 bcf oled_rw | 91 addwfc PRODH |
113 bsf oled_rw ; Lower | |
114 | |
115 ; Reset Column+1 | |
116 movlw 0x21 ; Start Address Vertical (.0 - .319) | 92 movlw 0x21 ; Start Address Vertical (.0 - .319) |
117 rcall PLED_CmdWrite | 93 rcall PLED_CmdWrite |
118 bcf STATUS,C | 94 rcall PLED_DataWrite_PROD |
119 rlcf LastSetColumn,W ; x2 | 95 ; Continue with PLED_PxlWrite_Single... |
120 movlw d'0' | |
121 btfsc STATUS,C ; Result >256? | |
122 movlw d'1' ; Yes! | |
123 rcall PLED_DatWrite ; Upper | |
124 bcf STATUS,C | |
125 rlcf LastSetColumn,F | |
126 incf LastSetColumn,W ; x2 | |
127 rcall PLED_DatWrite ; Lower | |
128 | |
129 ; Reset Row | |
130 movlw 0x20 ; Horizontal Address START:END | |
131 rcall PLED_CmdWrite | |
132 movlw 0x00 | |
133 rcall PLED_DatWrite | |
134 movf LastSetRow,W | |
135 rcall PLED_DatWrite | |
136 | |
137 ; Write 2nd Pixel on same row but one column to the right | |
138 movlw 0x22 ; Start Writing Data to GRAM | |
139 rcall PLED_CmdWrite | |
140 bsf oled_rs ; Data! | |
141 movff win_color1,PORTD | |
142 bcf oled_rw | |
143 bsf oled_rw ; Upper | |
144 movff win_color2,PORTD | |
145 bcf oled_rw | |
146 bsf oled_rw ; Lower | |
147 return | |
148 | 96 |
149 ; ----------------------------- | 97 ; ----------------------------- |
150 ; PLED Write One Pixel | 98 ; PLED Write One Pixel |
151 ; ----------------------------- | 99 ; ----------------------------- |
152 PLED_PxlWrite_Single: | 100 PLED_PxlWrite_Single: |
172 bcf oled_e_nwr | 120 bcf oled_e_nwr |
173 bcf oled_rw | 121 bcf oled_rw |
174 bcf oled_nreset | 122 bcf oled_nreset |
175 return | 123 return |
176 | 124 |
177 ; ----------------------------- | 125 ;============================================================================= |
178 ; PLED FRAME (win_color1 and win_color2) | 126 ; PLED_frame : draw a frame around current box with current color. |
179 ; ----------------------------- | 127 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 |
128 ; Outputs: (none) | |
129 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 | |
130 | |
180 PLED_frame: | 131 PLED_frame: |
181 movf box_temp+0,W | 132 movff win_top,aa_start+0 ; Backup everything. |
182 call PLED_set_color | 133 movff win_height,aa_start+1 |
183 ; draw right line from row top (box_temp+1) to row bottom (box_temp+2) | 134 movff win_leftx2,aa_end+0 |
184 movff box_temp+1,draw_box_temp1 ; Store start row | 135 movff win_width,aa_end+1 |
185 PLED_frame2: | 136 |
186 movf draw_box_temp1,W ; d'0' ... d'239' | 137 ;---- TOP line ----------------------------------------------------------- |
187 rcall PLED_SetRow ; Set Row | 138 movlw 1 ; row ~ height=1 |
188 movf box_temp+3,W ; d'0' ... d'159' | 139 movff WREG,win_height |
189 call PLED_SetColumnPixel ; Set left column | 140 rcall PLED_box |
190 rcall PLED_PxlWrite_Single ; Write Pixel | 141 |
191 incf draw_box_temp1,F | 142 ;---- BOTTOM line -------------------------------------------------------- |
192 movf draw_box_temp1,W ; Copy to W | 143 movff aa_start+0,PRODL ; Get back top, |
193 cpfseq box_temp+2 ; Done? | 144 movff aa_start+1,WREG ; and height |
194 bra PLED_frame2 ; Not yet... | 145 addwf PRODL,W ; top+height |
195 | 146 decf WREG ; top+height-1 |
196 movf draw_box_temp1,W ; d'0' ... d'239' | 147 movff WREG,win_top ; top+height-1 --> top |
197 rcall PLED_SetRow ; Set Row | 148 rcall PLED_box |
198 movf box_temp+3,W ; d'0' ... d'159' | 149 |
199 call PLED_SetColumnPixel ; Set left column | 150 ;---- LEFT column -------------------------------------------------------- |
200 rcall PLED_PxlWrite_Single ; Write Pixel | 151 movff aa_start+0,win_top ; Restore top/height. |
201 | 152 movff aa_start+1,win_height |
202 ; draw left line from row top (box_temp+1) to row bottom (box_temp+2) | 153 movlw 1 ; column ~ width=1 |
203 movff box_temp+1,draw_box_temp1 ; Store start row | 154 movff WREG,win_width |
204 PLED_frame3: | 155 rcall PLED_box |
205 movf draw_box_temp1,W ; d'0' ... d'239' | 156 |
206 rcall PLED_SetRow ; Set Row | 157 ;---- RIGHT column ------------------------------------------------------- |
207 movf box_temp+4,W ; d'0' ... d'159' | 158 movff aa_end+0,WREG |
208 call PLED_SetColumnPixel ; Set left column | 159 movff aa_end+1,PRODL |
209 rcall PLED_PxlWrite_Single ; Write Pixel | 160 addwf PRODL,W |
210 incf draw_box_temp1,F | 161 decf WREG |
211 movf draw_box_temp1,W ; Copy to W | 162 movff WREG,win_leftx2 |
212 cpfseq box_temp+2 ; Done? | 163 bra PLED_box |
213 bra PLED_frame3 ; Not yet... | 164 |
214 | 165 ;============================================================================= |
215 movf draw_box_temp1,W ; d'0' ... d'239' | 166 ; PLED_box : fills current box with current color. |
216 rcall PLED_SetRow ; Set Row | 167 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 |
217 movf box_temp+4,W ; d'0' ... d'159' | 168 ; Outputs: (none) |
218 call PLED_SetColumnPixel ; Set left column | 169 ; Trashed: WREG, PROD |
219 rcall PLED_PxlWrite_Single ; Write Pixel | 170 |
220 | |
221 ; draw top line from box_temp+3 (0-159) to box_temp+4 (0-159) | |
222 movff box_temp+3,draw_box_temp1 ; Store start column | |
223 PLED_frame4: | |
224 movf draw_box_temp1,W ; d'0' ... d'159' | |
225 rcall PLED_SetColumnPixel ; Set Column | |
226 movf box_temp+1,W ; d'0' ... d'239' | |
227 rcall PLED_SetRow ; Set Row | |
228 rcall PLED_PxlWrite ; Write 2 Pixels | |
229 incf draw_box_temp1,F | |
230 movf draw_box_temp1,W | |
231 cpfseq box_temp+4 | |
232 bra PLED_frame4 | |
233 | |
234 ; draw bottom line from box_temp+3 (0-159) to box_temp+4 (0-159) | |
235 movff box_temp+3,draw_box_temp1 ; Store start column | |
236 PLED_frame5: | |
237 movf draw_box_temp1,W ; d'0' ... d'159' | |
238 rcall PLED_SetColumnPixel ; Set Column | |
239 movf box_temp+2,W ; d'0' ... d'239' | |
240 rcall PLED_SetRow ; Set Row | |
241 rcall PLED_PxlWrite ; Write 2 Pixels | |
242 incf draw_box_temp1,F | |
243 movf draw_box_temp1,W | |
244 cpfseq box_temp+4 | |
245 bra PLED_frame5 | |
246 | |
247 call PLED_standard_color | |
248 | |
249 return | |
250 | |
251 ; ----------------------------- | |
252 ; PLED Box (win_color1 and win_color2) | |
253 ; ----------------------------- | |
254 PLED_box: | 171 PLED_box: |
255 movf box_temp+0,W | 172 ;---- Define Window ------------------------------------------------------ |
256 call PLED_set_color | |
257 ; /Define Window | |
258 movlw 0x35 ; VerticalStartAddress HIGH:LOW | 173 movlw 0x35 ; VerticalStartAddress HIGH:LOW |
259 rcall PLED_CmdWrite | 174 rcall PLED_CmdWrite |
260 movff box_temp+3,draw_box_temp1 | 175 movff win_leftx2,WREG |
261 bcf STATUS,C | 176 mullw 2 |
262 rlcf draw_box_temp1,W ; x2 | 177 rcall PLED_DataWrite_PROD |
263 movlw d'0' | |
264 btfsc STATUS,C ; Result >255? | |
265 movlw d'1' ; Yes: Upper=1! | |
266 rcall PLED_DatWrite ; Upper | |
267 bcf STATUS,C | |
268 rlcf draw_box_temp1,W ; x2 -> WREG | |
269 rcall PLED_DatWrite ; Lower | |
270 | 178 |
271 movlw 0x36 ; VerticalEndAddress HIGH:LOW | 179 movlw 0x36 ; VerticalEndAddress HIGH:LOW |
272 rcall PLED_CmdWrite | 180 rcall PLED_CmdWrite |
273 movff box_temp+4,draw_box_temp1 | 181 movff win_width,PRODL ; Bank-safe addressing |
274 bcf STATUS,C | 182 movff win_leftx2,WREG |
275 rlcf draw_box_temp1,W ; x2 | 183 addwf PRODL,W ; left+width |
276 movlw d'0' | 184 decf WREG ; left+width-1 |
277 btfsc STATUS,C ; Result >255? | 185 mullw 2 ; times 2 --> rightx2 |
278 movlw d'1' ; Yes: Upper=1! | 186 rcall PLED_DataWrite_PROD |
279 rcall PLED_DatWrite ; Upper | |
280 bcf STATUS,C | |
281 rlcf draw_box_temp1,W ; x2 -> WREG | |
282 rcall PLED_DatWrite ; Lower | |
283 | 187 |
284 movlw 0x37 ; HorizontalAddress START:END | 188 movlw 0x37 ; HorizontalAddress START:END |
285 rcall PLED_CmdWrite | 189 rcall PLED_CmdWrite |
286 movff box_temp+1,draw_box_temp1 | 190 movff win_top,PRODH ; Start row. |
287 movf draw_box_temp1,W | 191 movff win_height,PRODL ; height |
288 rcall PLED_DatWrite | 192 movf PRODH,W |
289 movff box_temp+2,draw_box_temp1 | 193 addwf PRODL,F ; top + height |
290 movf draw_box_temp1,W | 194 decf PRODL,F ; top + height - 1 --> bottom. |
291 rcall PLED_DatWrite | 195 rcall PLED_DataWrite_PROD |
292 | 196 |
197 ;---- Start pointer ------------------------------------------------------ | |
293 movlw 0x20 ; Start Address Horizontal (.0 - .239) | 198 movlw 0x20 ; Start Address Horizontal (.0 - .239) |
294 rcall PLED_CmdWrite | 199 rcall PLED_CmdWrite |
295 movlw 0x00 | 200 movff win_top,WREG |
296 rcall PLED_DatWrite | 201 mullw 1 |
297 movff box_temp+1,draw_box_temp1 | 202 rcall PLED_DataWrite_PROD |
298 movf draw_box_temp1,W | |
299 rcall PLED_DatWrite | |
300 | 203 |
301 movlw 0x21 ; Start Address Vertical (.0 - .319) | 204 movlw 0x21 ; Start Address Vertical (.0 - .319) |
302 rcall PLED_CmdWrite | 205 rcall PLED_CmdWrite |
303 movff box_temp+3,draw_box_temp1 | 206 movff win_leftx2,WREG |
304 bcf STATUS,C | 207 mullw 2 |
305 rlcf draw_box_temp1,W ; x2 | 208 rcall PLED_DataWrite_PROD |
306 movlw d'0' | 209 |
307 btfsc STATUS,C ; Result >255? | 210 ;---- Fill Window -------------------------------------------------------- |
308 movlw d'1' ; Yes: Upper=1! | |
309 rcall PLED_DatWrite ; Upper | |
310 bcf STATUS,C | |
311 rlcf draw_box_temp1,W ; x2 -> WREG | |
312 rcall PLED_DatWrite ; Lower | |
313 ; /Define Window | |
314 | |
315 ; Fill Window | |
316 movlw 0x22 ; Start Writing Data to GRAM | 211 movlw 0x22 ; Start Writing Data to GRAM |
317 rcall PLED_CmdWrite | 212 rcall PLED_CmdWrite |
318 | 213 |
319 movff box_temp+1,draw_box_temp1 | 214 movff win_height,PRODH |
320 movff box_temp+2,draw_box_temp2 | |
321 movf draw_box_temp1,W | |
322 subwf draw_box_temp2,F ; X length | |
323 incf draw_box_temp2,F | |
324 | |
325 movff box_temp+3,draw_box_temp1 | |
326 movff box_temp+4,draw_box_temp3 | |
327 movf draw_box_temp1,W | |
328 subwf draw_box_temp3,F ; Y length/2 | |
329 | |
330 incf draw_box_temp3,F ; Last pixel... | |
331 | |
332 bsf oled_rs ; Data! | 215 bsf oled_rs ; Data! |
333 | 216 |
334 PLED_box2: | 217 PLED_box2: ; Loop height times |
335 movff draw_box_temp3,draw_box_temp1 | 218 movff win_width,PRODL |
336 PLED_box3: | 219 PLED_box3: ; loop width times |
337 movff win_color1,PORTD | 220 movff win_color1,PORTD |
338 bcf oled_rw | 221 bcf oled_rw |
339 bsf oled_rw ; Upper | 222 bsf oled_rw ; Upper |
340 movff win_color2,PORTD | 223 movff win_color2,PORTD |
341 bcf oled_rw | 224 bcf oled_rw |
346 bsf oled_rw ; Upper | 229 bsf oled_rw ; Upper |
347 movff win_color2,PORTD | 230 movff win_color2,PORTD |
348 bcf oled_rw | 231 bcf oled_rw |
349 bsf oled_rw ; Lower | 232 bsf oled_rw ; Lower |
350 | 233 |
351 decfsz draw_box_temp1,F | 234 decfsz PRODL,F |
352 bra PLED_box3 | 235 bra PLED_box3 |
353 decfsz draw_box_temp2,F | 236 decfsz PRODH,F |
354 bra PLED_box2 | 237 bra PLED_box2 |
355 | 238 |
356 movlw 0x00 ; NOP, to stop Address Update Counter | 239 movlw 0x00 ; NOP, to stop Address Update Counter |
357 rcall PLED_CmdWrite | 240 bra PLED_CmdWrite |
358 | 241 |
359 call PLED_standard_color | 242 ;============================================================================= |
360 return | 243 ; PLED_ClearScreen: An optimized version of PLEX_box, for ful screen black. |
361 | 244 ; Trashed: WREG, PROD |
362 ; ----------------------------- | 245 |
363 ; PLED_ClearScreen: | |
364 ; ----------------------------- | |
365 PLED_ClearScreen: | 246 PLED_ClearScreen: |
366 movlw 0x35 ; VerticalStartAddress HIGH:LOW | 247 movlw 0x35 ; VerticalStartAddress HIGH:LOW |
367 rcall PLED_CmdWrite | 248 rcall PLED_CmdWrite |
368 movlw 0x00 | 249 mullw 0 |
369 rcall PLED_DatWrite | 250 rcall PLED_DataWrite_PROD |
370 movlw 0x00 | |
371 rcall PLED_DatWrite | |
372 | 251 |
373 movlw 0x36 ; VerticalEndAddress HIGH:LOW | 252 movlw 0x36 ; VerticalEndAddress HIGH:LOW |
374 rcall PLED_CmdWrite | 253 rcall PLED_CmdWrite |
375 movlw 0x01 | 254 movlw 0x01 |
376 rcall PLED_DatWrite | 255 rcall PLED_DataWrite |
377 movlw 0x3F | 256 movlw 0x3F |
378 rcall PLED_DatWrite | 257 rcall PLED_DataWrite |
379 | 258 |
380 movlw 0x37 ; HorizontalAddress START:END | 259 movlw 0x37 ; HorizontalAddress START:END |
381 rcall PLED_CmdWrite | 260 rcall PLED_CmdWrite |
382 movlw 0x00 | 261 movlw 0x00 |
383 rcall PLED_DatWrite | 262 rcall PLED_DataWrite |
384 movlw 0xEF | 263 movlw 0xEF |
385 rcall PLED_DatWrite | 264 rcall PLED_DataWrite |
386 | 265 |
387 movlw 0x20 ; Start Address Horizontal (.0 - .239) | 266 movlw 0x20 ; Start Address Horizontal (.0 - .239) |
388 rcall PLED_CmdWrite | 267 rcall PLED_CmdWrite |
389 movlw 0x00 | 268 rcall PLED_DataWrite_PROD |
390 rcall PLED_DatWrite | |
391 movlw 0x00 | |
392 rcall PLED_DatWrite | |
393 | 269 |
394 movlw 0x21 ; Start Address Vertical (.0 - .319) | 270 movlw 0x21 ; Start Address Vertical (.0 - .319) |
395 rcall PLED_CmdWrite | 271 rcall PLED_CmdWrite |
396 movlw 0x00 | 272 rcall PLED_DataWrite_PROD |
397 rcall PLED_DatWrite | |
398 movlw 0x00 | |
399 rcall PLED_DatWrite | |
400 | 273 |
401 movlw 0x22 ; Start Writing Data to GRAM | 274 movlw 0x22 ; Start Writing Data to GRAM |
402 rcall PLED_CmdWrite | 275 rcall PLED_CmdWrite |
403 | 276 |
404 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks | 277 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks |
405 bsf oled_rs ; Data! | 278 bsf oled_rs ; Data! |
406 | 279 |
407 movlw d'10' | 280 movlw .160 |
408 movwf draw_box_temp3 | 281 movwf PRODH |
409 PLED_ClearScreen2: | 282 PLED_ClearScreen2: |
410 movlw d'30' | 283 movlw .240 |
411 movwf draw_box_temp2 | 284 movwf PRODL |
412 PLED_ClearScreen3: | 285 PLED_ClearScreen3: |
413 clrf draw_box_temp1 ; 30*10*256=76800 Pixels -> Clear complete 240*320 | |
414 PLED_ClearScreen4: | |
415 | 286 |
416 clrf PORTD ; Need to generate trace here too. | 287 clrf PORTD ; Need to generate trace here too. |
417 bcf oled_rw | 288 bcf oled_rw |
418 bsf oled_rw ; Upper | 289 bsf oled_rw ; Upper |
419 | 290 |
420 clrf PORTD ; Need to generate trace here too. | 291 clrf PORTD ; Need to generate trace here too. |
421 bcf oled_rw | 292 bcf oled_rw |
422 bsf oled_rw ; Lower | 293 bsf oled_rw ; Lower |
423 | 294 |
424 decfsz draw_box_temp1,F | 295 clrf PORTD ; Need to generate trace here too. |
425 bra PLED_ClearScreen4 | 296 bcf oled_rw |
426 decfsz draw_box_temp2,F | 297 bsf oled_rw ; Upper |
298 | |
299 clrf PORTD ; Need to generate trace here too. | |
300 bcf oled_rw | |
301 bsf oled_rw ; Lower | |
302 | |
303 decfsz PRODL,F | |
427 bra PLED_ClearScreen3 | 304 bra PLED_ClearScreen3 |
428 decfsz draw_box_temp3,F | 305 decfsz PRODH,F |
429 bra PLED_ClearScreen2 | 306 bra PLED_ClearScreen2 |
430 | 307 |
431 movlw 0x00 ; NOP, to stop Address Update Counter | 308 movlw 0x00 ; NOP, to stop Address Update Counter |
432 rcall PLED_CmdWrite | 309 bra PLED_CmdWrite |
433 | |
434 return | |
435 | |
436 | 310 |
437 ; ----------------------------- | 311 ; ----------------------------- |
438 ; PLED Write Cmd via W | 312 ; PLED Write Cmd via W |
439 ; ----------------------------- | 313 ; ----------------------------- |
440 PLED_CmdWrite: | 314 PLED_CmdWrite: |
446 | 320 |
447 ; ----------------------------- | 321 ; ----------------------------- |
448 ; PLED Write Display Data via W | 322 ; PLED Write Display Data via W |
449 ; ----------------------------- | 323 ; ----------------------------- |
450 PLED_DataWrite: | 324 PLED_DataWrite: |
451 | |
452 ; ----------------------------- | |
453 ; PLED Data Cmd via W | |
454 ; ----------------------------- | |
455 PLED_DatWrite: | |
456 bsf oled_rs ; Data! | 325 bsf oled_rs ; Data! |
457 movwf PORTD ; Move Data to PORTD | 326 movwf PORTD ; Move Data to PORTD |
327 bcf oled_rw | |
328 bsf oled_rw | |
329 return | |
330 | |
331 ; ----------------------------- | |
332 ; PLED Data Cmd via W | |
333 ; ----------------------------- | |
334 PLED_DataWrite_PROD: | |
335 bsf oled_rs ; Data! | |
336 movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian) | |
337 bcf oled_rw | |
338 bsf oled_rw | |
339 movff PRODL,PORTD ; Move low byte to PORTD | |
458 bcf oled_rw | 340 bcf oled_rw |
459 bsf oled_rw | 341 bsf oled_rw |
460 return | 342 return |
461 | 343 |
462 ; ----------------------------- | 344 ; ----------------------------- |
483 rcall PLED_CmdWrite | 365 rcall PLED_CmdWrite |
484 | 366 |
485 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) | 367 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) |
486 rcall PLED_CmdWrite | 368 rcall PLED_CmdWrite |
487 movlw 0x00 ; X X X X X X X RM | 369 movlw 0x00 ; X X X X X X X RM |
488 rcall PLED_DatWrite | 370 rcall PLED_DataWrite |
489 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL | 371 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL |
490 rcall PLED_DatWrite ; System Interface: RIM is ignored, Internal Clock | 372 rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock |
491 | 373 |
492 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | 374 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) |
493 rcall PLED_CmdWrite | 375 rcall PLED_CmdWrite |
494 movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color | 376 movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color |
495 rcall PLED_DatWrite | 377 rcall PLED_DataWrite |
496 movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM | 378 movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM |
497 rcall PLED_DatWrite | 379 rcall PLED_DataWrite |
498 | 380 |
499 movlw 0x18 | 381 movlw 0x18 |
500 rcall PLED_CmdWrite | 382 rcall PLED_CmdWrite |
501 movlw 0x00 | 383 movlw 0x00 |
502 rcall PLED_DatWrite | 384 rcall PLED_DataWrite |
503 movlw 0x28 | 385 movlw 0x28 |
504 rcall PLED_DatWrite | 386 rcall PLED_DataWrite |
505 | 387 |
506 movlw 0xF8 | 388 movlw 0xF8 |
507 rcall PLED_CmdWrite | 389 rcall PLED_CmdWrite |
508 movlw 0x00 | 390 movlw 0x00 |
509 rcall PLED_DatWrite | 391 rcall PLED_DataWrite |
510 movlw 0x0F | 392 movlw 0x0F |
511 rcall PLED_DatWrite | 393 rcall PLED_DataWrite |
512 | 394 |
513 movlw 0xF9 | 395 movlw 0xF9 |
514 rcall PLED_CmdWrite | 396 rcall PLED_CmdWrite |
515 movlw 0x00 | 397 movlw 0x00 |
516 rcall PLED_DatWrite | 398 rcall PLED_DataWrite |
517 movlw 0x0F | 399 movlw 0x0F |
518 rcall PLED_DatWrite | 400 rcall PLED_DataWrite |
519 | 401 |
520 movlw 0x10 | 402 movlw 0x10 |
521 rcall PLED_CmdWrite | 403 rcall PLED_CmdWrite |
522 movlw 0x00 | 404 movlw 0x00 |
523 rcall PLED_DatWrite | 405 rcall PLED_DataWrite |
524 movlw 0x00 | 406 movlw 0x00 |
525 rcall PLED_DatWrite | 407 rcall PLED_DataWrite |
526 | 408 |
527 ; Now Gamma settings... | 409 ; Now Gamma settings... |
528 rcall PLED_brightness_full | 410 rcall PLED_brightness_full |
529 ;rcall PLED_brightness_low | 411 ;rcall PLED_brightness_low |
530 ; End Gamma Settings | 412 ; End Gamma Settings |
535 WAITMS d'32' | 417 WAITMS d'32' |
536 | 418 |
537 movlw 0x05 | 419 movlw 0x05 |
538 rcall PLED_CmdWrite | 420 rcall PLED_CmdWrite |
539 movlw 0x00 | 421 movlw 0x00 |
540 rcall PLED_DatWrite | 422 rcall PLED_DataWrite |
541 movlw 0x01 | 423 movlw 0x01 |
542 rcall PLED_DatWrite ; Display ON | 424 rcall PLED_DataWrite ; Display ON |
543 return | 425 return |
544 | 426 |
545 | 427 |
546 PLED_brightness_full: | 428 PLED_brightness_full: |
547 movlw 0x70 | 429 movlw 0x70 |
548 rcall PLED_CmdWrite | 430 rcall PLED_CmdWrite |
549 movlw 0x1F | 431 movlw 0x1F |
550 rcall PLED_DatWrite | 432 rcall PLED_DataWrite |
551 movlw 0x00 | 433 movlw 0x00 |
552 rcall PLED_DatWrite | 434 rcall PLED_DataWrite |
553 movlw 0x71 | 435 movlw 0x71 |
554 rcall PLED_CmdWrite | 436 rcall PLED_CmdWrite |
555 movlw 0x23 | 437 movlw 0x23 |
556 rcall PLED_DatWrite | 438 rcall PLED_DataWrite |
557 movlw 0x80 | 439 movlw 0x80 |
558 rcall PLED_DatWrite | 440 rcall PLED_DataWrite |
559 movlw 0x72 | 441 movlw 0x72 |
560 rcall PLED_CmdWrite | 442 rcall PLED_CmdWrite |
561 movlw 0x2A | 443 movlw 0x2A |
562 rcall PLED_DatWrite | 444 rcall PLED_DataWrite |
563 movlw 0x80 | 445 movlw 0x80 |
564 rcall PLED_DatWrite | 446 rcall PLED_DataWrite |
565 | 447 |
566 movlw 0x73 | 448 movlw 0x73 |
567 rcall PLED_CmdWrite | 449 rcall PLED_CmdWrite |
568 movlw 0x15 | 450 movlw 0x15 |
569 rcall PLED_DatWrite | 451 rcall PLED_DataWrite |
570 movlw 0x11 | 452 movlw 0x11 |
571 rcall PLED_DatWrite | 453 rcall PLED_DataWrite |
572 movlw 0x74 | 454 movlw 0x74 |
573 rcall PLED_CmdWrite | 455 rcall PLED_CmdWrite |
574 movlw 0x1C | 456 movlw 0x1C |
575 rcall PLED_DatWrite | 457 rcall PLED_DataWrite |
576 movlw 0x11 | 458 movlw 0x11 |
577 rcall PLED_DatWrite | 459 rcall PLED_DataWrite |
578 | 460 |
579 movlw 0x75 | 461 movlw 0x75 |
580 rcall PLED_CmdWrite | 462 rcall PLED_CmdWrite |
581 movlw 0x1B | 463 movlw 0x1B |
582 rcall PLED_DatWrite | 464 rcall PLED_DataWrite |
583 movlw 0x15 | 465 movlw 0x15 |
584 rcall PLED_DatWrite | 466 rcall PLED_DataWrite |
585 movlw 0x76 | 467 movlw 0x76 |
586 rcall PLED_CmdWrite | 468 rcall PLED_CmdWrite |
587 movlw 0x1A | 469 movlw 0x1A |
588 rcall PLED_DatWrite | 470 rcall PLED_DataWrite |
589 movlw 0x15 | 471 movlw 0x15 |
590 rcall PLED_DatWrite | 472 rcall PLED_DataWrite |
591 | 473 |
592 movlw 0x77 | 474 movlw 0x77 |
593 rcall PLED_CmdWrite | 475 rcall PLED_CmdWrite |
594 movlw 0x1C | 476 movlw 0x1C |
595 rcall PLED_DatWrite | 477 rcall PLED_DataWrite |
596 movlw 0x18 | 478 movlw 0x18 |
597 rcall PLED_DatWrite | 479 rcall PLED_DataWrite |
598 movlw 0x78 | 480 movlw 0x78 |
599 rcall PLED_CmdWrite | 481 rcall PLED_CmdWrite |
600 movlw 0x21 | 482 movlw 0x21 |
601 rcall PLED_DatWrite | 483 rcall PLED_DataWrite |
602 movlw 0x15 | 484 movlw 0x15 |
603 rcall PLED_DatWrite | 485 rcall PLED_DataWrite |
604 | 486 |
605 return | 487 return |
606 | 488 |
607 PLED_brightness_low: | 489 PLED_brightness_low: |
608 movlw 0x70 | 490 movlw 0x70 |
609 rcall PLED_CmdWrite | 491 rcall PLED_CmdWrite |
610 movlw 0x14 | 492 movlw 0x14 |
611 rcall PLED_DatWrite | 493 rcall PLED_DataWrite |
612 movlw 0x00 | 494 movlw 0x00 |
613 rcall PLED_DatWrite | 495 rcall PLED_DataWrite |
614 movlw 0x71 | 496 movlw 0x71 |
615 rcall PLED_CmdWrite | 497 rcall PLED_CmdWrite |
616 movlw 0x17 | 498 movlw 0x17 |
617 rcall PLED_DatWrite | 499 rcall PLED_DataWrite |
618 movlw 0x00 | 500 movlw 0x00 |
619 rcall PLED_DatWrite | 501 rcall PLED_DataWrite |
620 movlw 0x72 | 502 movlw 0x72 |
621 rcall PLED_CmdWrite | 503 rcall PLED_CmdWrite |
622 movlw 0x15 | 504 movlw 0x15 |
623 rcall PLED_DatWrite | 505 rcall PLED_DataWrite |
624 movlw 0x80 | 506 movlw 0x80 |
625 rcall PLED_DatWrite | 507 rcall PLED_DataWrite |
626 | 508 |
627 movlw 0x73 | 509 movlw 0x73 |
628 rcall PLED_CmdWrite | 510 rcall PLED_CmdWrite |
629 movlw 0x15 | 511 movlw 0x15 |
630 rcall PLED_DatWrite | 512 rcall PLED_DataWrite |
631 movlw 0x11 | 513 movlw 0x11 |
632 rcall PLED_DatWrite | 514 rcall PLED_DataWrite |
633 movlw 0x74 | 515 movlw 0x74 |
634 rcall PLED_CmdWrite | 516 rcall PLED_CmdWrite |
635 movlw 0x14 | 517 movlw 0x14 |
636 rcall PLED_DatWrite | 518 rcall PLED_DataWrite |
637 movlw 0x0B | 519 movlw 0x0B |
638 rcall PLED_DatWrite | 520 rcall PLED_DataWrite |
639 | 521 |
640 movlw 0x75 | 522 movlw 0x75 |
641 rcall PLED_CmdWrite | 523 rcall PLED_CmdWrite |
642 movlw 0x1B | 524 movlw 0x1B |
643 rcall PLED_DatWrite | 525 rcall PLED_DataWrite |
644 movlw 0x15 | 526 movlw 0x15 |
645 rcall PLED_DatWrite | 527 rcall PLED_DataWrite |
646 movlw 0x76 | 528 movlw 0x76 |
647 rcall PLED_CmdWrite | 529 rcall PLED_CmdWrite |
648 movlw 0x13 | 530 movlw 0x13 |
649 rcall PLED_DatWrite | 531 rcall PLED_DataWrite |
650 movlw 0x0E | 532 movlw 0x0E |
651 rcall PLED_DatWrite | 533 rcall PLED_DataWrite |
652 | 534 |
653 movlw 0x77 | 535 movlw 0x77 |
654 rcall PLED_CmdWrite | 536 rcall PLED_CmdWrite |
655 movlw 0x1C | 537 movlw 0x1C |
656 rcall PLED_DatWrite | 538 rcall PLED_DataWrite |
657 movlw 0x18 | 539 movlw 0x18 |
658 rcall PLED_DatWrite | 540 rcall PLED_DataWrite |
659 movlw 0x78 | 541 movlw 0x78 |
660 rcall PLED_CmdWrite | 542 rcall PLED_CmdWrite |
661 movlw 0x15 | 543 movlw 0x15 |
662 rcall PLED_DatWrite | 544 rcall PLED_DataWrite |
663 movlw 0x0E | 545 movlw 0x0E |
664 rcall PLED_DatWrite | 546 rcall PLED_DataWrite |
665 | 547 |
666 return | 548 return |
667 | 549 |
668 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' | 550 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' |
669 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' | 551 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' |