Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 90:6655b1c59adc
FIX new cf menu BOOL mode: should skip lines 2&3.
author | JeanDo |
---|---|
date | Fri, 10 Dec 2010 02:36:56 +0100 |
parents | 3e351e25f5d1 |
children | 6a94f96e9cea |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2009 HeinrichsWeikamp GbR | |
3 | |
4 ; This program is free software: you can redistribute it and/or modify | |
5 ; it under the terms of the GNU General Public License as published by | |
6 ; the Free Software Foundation, either version 3 of the License, or | |
7 ; (at your option) any later version. | |
8 | |
9 ; This program is distributed in the hope that it will be useful, | |
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ; GNU General Public License for more details. | |
13 | |
14 ; You should have received a copy of the GNU General Public License | |
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 | |
18 ; hardware routines for S6E6D6 Samsung OLED Driver IC | |
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
20 ; written: 090801 | |
21 ; last updated: 090830 | |
22 ; known bugs: | |
23 ; ToDo: Optimise PLED_box calls | |
24 | |
25 WIN_FONT macro win_font_input | |
26 movlw win_font_input | |
27 movff WREG,win_font | |
28 endm | |
29 | |
30 WIN_TOP macro win_top_input | |
31 movlw win_top_input | |
32 movff WREG,win_top | |
33 endm | |
34 | |
35 WIN_LEFT macro win_left_input | |
36 movlw win_left_input | |
37 movff WREG,win_leftx2 | |
38 endm | |
39 | |
40 WIN_INVERT macro win_invert_input | |
41 movlw win_invert_input | |
42 movff WREG,win_invert | |
43 endm | |
44 | |
45 WIN_COLOR macro win_color_input | |
46 movlw win_color_input | |
47 call PLED_set_color | |
48 endm | |
49 | |
50 | |
51 word_processor: ; word_processor: | |
52 clrf POSTINC2 ; Required! | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
53 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
54 ifdef AAFONTS |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
55 call aa_wordprocessor |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
56 movlb b'00000001' ; Back to Rambank1 |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
57 else |
0 | 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 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
64 endif |
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
65 |
0 | 66 return |
67 | |
68 ; ----------------------------- | |
69 ; PLED_SetColumnPixel: | |
70 ; ----------------------------- | |
71 PLED_SetColumnPixel: | |
72 movwf LastSetColumn ; d'0' ... d'159' | |
73 movff LastSetColumn,win_leftx2 | |
74 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
75 rcall PLED_CmdWrite | |
76 bcf STATUS,C | |
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 | |
87 ; ----------------------------- | |
88 ; PLED_SetRow: | |
89 ; ----------------------------- | |
90 PLED_SetRow: | |
91 movwf LastSetRow ; d'0' ... d'239' | |
92 movff LastSetRow,win_top | |
93 movlw 0x20 ; Horizontal Address START:END | |
94 rcall PLED_CmdWrite | |
95 movlw 0x00 | |
96 rcall PLED_DatWrite | |
97 movf LastSetRow,W | |
98 rcall PLED_DatWrite | |
99 return | |
100 | |
101 ; ----------------------------- | |
102 ; PLED Write Two Pixel | |
103 ; ----------------------------- | |
104 PLED_PxlWrite: | |
105 movlw 0x22 ; Start Writing Data to GRAM | |
106 rcall PLED_CmdWrite | |
107 bsf oled_rs ; Data! | |
108 movff win_color1,PORTD | |
109 bcf oled_rw | |
110 bsf oled_rw ; Upper | |
111 movff win_color2,PORTD | |
112 bcf oled_rw | |
113 bsf oled_rw ; Lower | |
114 | |
115 ; Reset Column+1 | |
116 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
117 rcall PLED_CmdWrite | |
118 bcf STATUS,C | |
119 rlcf LastSetColumn,W ; x2 | |
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 | |
149 ; ----------------------------- | |
150 ; PLED Write One Pixel | |
151 ; ----------------------------- | |
152 PLED_PxlWrite_Single: | |
153 movlw 0x22 ; Start Writing Data to GRAM | |
154 rcall PLED_CmdWrite | |
155 bsf oled_rs ; Data! | |
156 movff win_color1, PORTD | |
157 bcf oled_rw | |
158 bsf oled_rw ; Upper | |
159 movff win_color2, PORTD | |
160 bcf oled_rw | |
161 bsf oled_rw ; Lower | |
162 return | |
163 | |
164 ; ----------------------------- | |
165 ; PLED Display Off | |
166 ; ----------------------------- | |
167 PLED_DisplayOff: | |
168 clrf PORTD | |
169 bcf oled_hv | |
170 bcf oled_vdd | |
171 bcf oled_cs | |
172 bcf oled_e_nwr | |
173 bcf oled_rw | |
174 bcf oled_nreset | |
175 return | |
176 | |
177 ; ----------------------------- | |
178 ; PLED FRAME (win_color1 and win_color2) | |
179 ; ----------------------------- | |
180 PLED_frame: | |
181 movf box_temp+0,W | |
182 call PLED_set_color | |
183 ; draw right line from row top (box_temp+1) to row bottom (box_temp+2) | |
184 movff box_temp+1,draw_box_temp1 ; Store start row | |
185 PLED_frame2: | |
186 movf draw_box_temp1,W ; d'0' ... d'239' | |
187 rcall PLED_SetRow ; Set Row | |
188 movf box_temp+3,W ; d'0' ... d'159' | |
189 call PLED_SetColumnPixel ; Set left column | |
190 rcall PLED_PxlWrite_Single ; Write Pixel | |
191 incf draw_box_temp1,F | |
192 movf draw_box_temp1,W ; Copy to W | |
193 cpfseq box_temp+2 ; Done? | |
194 bra PLED_frame2 ; Not yet... | |
195 | |
196 movf draw_box_temp1,W ; d'0' ... d'239' | |
197 rcall PLED_SetRow ; Set Row | |
198 movf box_temp+3,W ; d'0' ... d'159' | |
199 call PLED_SetColumnPixel ; Set left column | |
200 rcall PLED_PxlWrite_Single ; Write Pixel | |
201 | |
202 ; draw left line from row top (box_temp+1) to row bottom (box_temp+2) | |
203 movff box_temp+1,draw_box_temp1 ; Store start row | |
204 PLED_frame3: | |
205 movf draw_box_temp1,W ; d'0' ... d'239' | |
206 rcall PLED_SetRow ; Set Row | |
207 movf box_temp+4,W ; d'0' ... d'159' | |
208 call PLED_SetColumnPixel ; Set left column | |
209 rcall PLED_PxlWrite_Single ; Write Pixel | |
210 incf draw_box_temp1,F | |
211 movf draw_box_temp1,W ; Copy to W | |
212 cpfseq box_temp+2 ; Done? | |
213 bra PLED_frame3 ; Not yet... | |
214 | |
215 movf draw_box_temp1,W ; d'0' ... d'239' | |
216 rcall PLED_SetRow ; Set Row | |
217 movf box_temp+4,W ; d'0' ... d'159' | |
218 call PLED_SetColumnPixel ; Set left column | |
219 rcall PLED_PxlWrite_Single ; Write Pixel | |
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 | |
3 | 247 call PLED_standard_color |
0 | 248 |
249 return | |
250 | |
251 ; ----------------------------- | |
252 ; PLED Box (win_color1 and win_color2) | |
253 ; ----------------------------- | |
254 PLED_box: | |
255 movf box_temp+0,W | |
256 call PLED_set_color | |
257 ; /Define Window | |
258 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
259 rcall PLED_CmdWrite | |
260 movff box_temp+3,draw_box_temp1 | |
261 bcf STATUS,C | |
262 rlcf draw_box_temp1,W ; x2 | |
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 | |
271 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
272 rcall PLED_CmdWrite | |
273 movff box_temp+4,draw_box_temp1 | |
274 bcf STATUS,C | |
275 rlcf draw_box_temp1,W ; x2 | |
276 movlw d'0' | |
277 btfsc STATUS,C ; Result >255? | |
278 movlw d'1' ; Yes: Upper=1! | |
279 rcall PLED_DatWrite ; Upper | |
280 bcf STATUS,C | |
281 rlcf draw_box_temp1,W ; x2 -> WREG | |
282 rcall PLED_DatWrite ; Lower | |
283 | |
284 movlw 0x37 ; HorizontalAddress START:END | |
285 rcall PLED_CmdWrite | |
286 movff box_temp+1,draw_box_temp1 | |
287 movf draw_box_temp1,W | |
288 rcall PLED_DatWrite | |
289 movff box_temp+2,draw_box_temp1 | |
290 movf draw_box_temp1,W | |
291 rcall PLED_DatWrite | |
292 | |
293 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
294 rcall PLED_CmdWrite | |
295 movlw 0x00 | |
296 rcall PLED_DatWrite | |
297 movff box_temp+1,draw_box_temp1 | |
298 movf draw_box_temp1,W | |
299 rcall PLED_DatWrite | |
300 | |
301 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
302 rcall PLED_CmdWrite | |
303 movff box_temp+3,draw_box_temp1 | |
304 bcf STATUS,C | |
305 rlcf draw_box_temp1,W ; x2 | |
306 movlw d'0' | |
307 btfsc STATUS,C ; Result >255? | |
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 | |
317 rcall PLED_CmdWrite | |
318 | |
319 movff box_temp+1,draw_box_temp1 | |
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! | |
333 | |
334 PLED_box2: | |
335 movff draw_box_temp3,draw_box_temp1 | |
336 PLED_box3: | |
337 movff win_color1,PORTD | |
338 bcf oled_rw | |
339 bsf oled_rw ; Upper | |
340 movff win_color2,PORTD | |
341 bcf oled_rw | |
342 bsf oled_rw ; Lower | |
343 | |
344 movff win_color1,PORTD | |
345 bcf oled_rw | |
346 bsf oled_rw ; Upper | |
347 movff win_color2,PORTD | |
348 bcf oled_rw | |
349 bsf oled_rw ; Lower | |
350 | |
351 decfsz draw_box_temp1,F | |
352 bra PLED_box3 | |
353 decfsz draw_box_temp2,F | |
354 bra PLED_box2 | |
355 | |
356 movlw 0x00 ; NOP, to stop Address Update Counter | |
357 rcall PLED_CmdWrite | |
358 | |
3 | 359 call PLED_standard_color |
0 | 360 return |
361 | |
362 ; ----------------------------- | |
363 ; PLED_ClearScreen: | |
364 ; ----------------------------- | |
365 PLED_ClearScreen: | |
366 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
367 rcall PLED_CmdWrite | |
368 movlw 0x00 | |
369 rcall PLED_DatWrite | |
370 movlw 0x00 | |
371 rcall PLED_DatWrite | |
372 | |
373 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
374 rcall PLED_CmdWrite | |
375 movlw 0x01 | |
376 rcall PLED_DatWrite | |
377 movlw 0x3F | |
378 rcall PLED_DatWrite | |
379 | |
380 movlw 0x37 ; HorizontalAddress START:END | |
381 rcall PLED_CmdWrite | |
382 movlw 0x00 | |
383 rcall PLED_DatWrite | |
384 movlw 0xEF | |
385 rcall PLED_DatWrite | |
386 | |
387 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
388 rcall PLED_CmdWrite | |
389 movlw 0x00 | |
390 rcall PLED_DatWrite | |
391 movlw 0x00 | |
392 rcall PLED_DatWrite | |
393 | |
394 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
395 rcall PLED_CmdWrite | |
396 movlw 0x00 | |
397 rcall PLED_DatWrite | |
398 movlw 0x00 | |
399 rcall PLED_DatWrite | |
400 | |
401 movlw 0x22 ; Start Writing Data to GRAM | |
402 rcall PLED_CmdWrite | |
403 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
404 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks |
0 | 405 bsf oled_rs ; Data! |
406 | |
407 movlw d'10' | |
408 movwf draw_box_temp3 | |
409 PLED_ClearScreen2: | |
410 movlw d'30' | |
411 movwf draw_box_temp2 | |
412 PLED_ClearScreen3: | |
413 clrf draw_box_temp1 ; 30*10*256=76800 Pixels -> Clear complete 240*320 | |
414 PLED_ClearScreen4: | |
415 | |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
416 clrf PORTD ; Need to generate trace here too. |
0 | 417 bcf oled_rw |
418 bsf oled_rw ; Upper | |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
419 |
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
420 clrf PORTD ; Need to generate trace here too. |
0 | 421 bcf oled_rw |
422 bsf oled_rw ; Lower | |
423 | |
424 decfsz draw_box_temp1,F | |
425 bra PLED_ClearScreen4 | |
426 decfsz draw_box_temp2,F | |
427 bra PLED_ClearScreen3 | |
428 decfsz draw_box_temp3,F | |
429 bra PLED_ClearScreen2 | |
430 | |
431 movlw 0x00 ; NOP, to stop Address Update Counter | |
432 rcall PLED_CmdWrite | |
433 | |
434 return | |
435 | |
436 | |
437 ; ----------------------------- | |
438 ; PLED Write Cmd via W | |
439 ; ----------------------------- | |
440 PLED_CmdWrite: | |
441 bcf oled_rs ; Command! | |
442 movwf PORTD ; Move Data to PORTD | |
443 bcf oled_rw | |
444 bsf oled_rw | |
445 return | |
446 | |
447 ; ----------------------------- | |
448 ; PLED Write Display Data via W | |
449 ; ----------------------------- | |
450 PLED_DataWrite: | |
451 | |
452 ; ----------------------------- | |
453 ; PLED Data Cmd via W | |
454 ; ----------------------------- | |
455 PLED_DatWrite: | |
456 bsf oled_rs ; Data! | |
457 movwf PORTD ; Move Data to PORTD | |
458 bcf oled_rw | |
459 bsf oled_rw | |
460 return | |
461 | |
462 ; ----------------------------- | |
463 ; PLED boot | |
464 ; ----------------------------- | |
465 PLED_boot: | |
466 bcf oled_hv | |
467 WAITMS d'32' | |
468 bsf oled_vdd | |
469 nop | |
470 bcf oled_cs | |
471 nop | |
472 bsf oled_nreset | |
3 | 473 ; WAITMS d'10' ; Quick wake-up |
474 WAITMS d'250' ; Standard wake-up | |
0 | 475 bsf oled_e_nwr |
476 nop | |
477 bcf oled_nreset | |
478 WAIT10US d'2' | |
479 bsf oled_nreset | |
480 WAITMS d'10' | |
481 | |
482 movlw 0x24 ; 80-System 8-Bit Mode | |
483 rcall PLED_CmdWrite | |
484 | |
485 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) | |
486 rcall PLED_CmdWrite | |
487 movlw 0x00 ; X X X X X X X RM | |
488 rcall PLED_DatWrite | |
489 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL | |
490 rcall PLED_DatWrite ; System Interface: RIM is ignored, Internal Clock | |
491 | |
492 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | |
493 rcall PLED_CmdWrite | |
494 movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color | |
495 rcall PLED_DatWrite | |
496 movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM | |
497 rcall PLED_DatWrite | |
498 | |
499 movlw 0x18 | |
500 rcall PLED_CmdWrite | |
501 movlw 0x00 | |
502 rcall PLED_DatWrite | |
503 movlw 0x28 | |
504 rcall PLED_DatWrite | |
505 | |
506 movlw 0xF8 | |
507 rcall PLED_CmdWrite | |
508 movlw 0x00 | |
509 rcall PLED_DatWrite | |
510 movlw 0x0F | |
511 rcall PLED_DatWrite | |
512 | |
513 movlw 0xF9 | |
514 rcall PLED_CmdWrite | |
515 movlw 0x00 | |
516 rcall PLED_DatWrite | |
517 movlw 0x0F | |
518 rcall PLED_DatWrite | |
519 | |
520 movlw 0x10 | |
521 rcall PLED_CmdWrite | |
522 movlw 0x00 | |
523 rcall PLED_DatWrite | |
524 movlw 0x00 | |
525 rcall PLED_DatWrite | |
526 | |
527 ; Now Gamma settings... | |
528 rcall PLED_brightness_full | |
2 | 529 ;rcall PLED_brightness_low |
0 | 530 ; End Gamma Settings |
531 | |
532 rcall PLED_ClearScreen | |
533 | |
534 bsf oled_hv | |
535 WAITMS d'32' | |
536 | |
537 movlw 0x05 | |
538 rcall PLED_CmdWrite | |
539 movlw 0x00 | |
540 rcall PLED_DatWrite | |
541 movlw 0x01 | |
542 rcall PLED_DatWrite ; Display ON | |
543 return | |
544 | |
545 | |
546 PLED_brightness_full: | |
547 movlw 0x70 | |
548 rcall PLED_CmdWrite | |
549 movlw 0x1F | |
550 rcall PLED_DatWrite | |
551 movlw 0x00 | |
552 rcall PLED_DatWrite | |
553 movlw 0x71 | |
554 rcall PLED_CmdWrite | |
555 movlw 0x23 | |
556 rcall PLED_DatWrite | |
557 movlw 0x80 | |
558 rcall PLED_DatWrite | |
559 movlw 0x72 | |
560 rcall PLED_CmdWrite | |
561 movlw 0x2A | |
562 rcall PLED_DatWrite | |
563 movlw 0x80 | |
564 rcall PLED_DatWrite | |
565 | |
566 movlw 0x73 | |
567 rcall PLED_CmdWrite | |
568 movlw 0x15 | |
569 rcall PLED_DatWrite | |
570 movlw 0x11 | |
571 rcall PLED_DatWrite | |
572 movlw 0x74 | |
573 rcall PLED_CmdWrite | |
574 movlw 0x1C | |
575 rcall PLED_DatWrite | |
576 movlw 0x11 | |
577 rcall PLED_DatWrite | |
578 | |
579 movlw 0x75 | |
580 rcall PLED_CmdWrite | |
581 movlw 0x1B | |
582 rcall PLED_DatWrite | |
583 movlw 0x15 | |
584 rcall PLED_DatWrite | |
585 movlw 0x76 | |
586 rcall PLED_CmdWrite | |
587 movlw 0x1A | |
588 rcall PLED_DatWrite | |
589 movlw 0x15 | |
590 rcall PLED_DatWrite | |
591 | |
592 movlw 0x77 | |
593 rcall PLED_CmdWrite | |
594 movlw 0x1C | |
595 rcall PLED_DatWrite | |
596 movlw 0x18 | |
597 rcall PLED_DatWrite | |
598 movlw 0x78 | |
599 rcall PLED_CmdWrite | |
600 movlw 0x21 | |
601 rcall PLED_DatWrite | |
602 movlw 0x15 | |
603 rcall PLED_DatWrite | |
604 | |
605 return | |
606 | |
607 PLED_brightness_low: | |
608 movlw 0x70 | |
609 rcall PLED_CmdWrite | |
610 movlw 0x14 | |
611 rcall PLED_DatWrite | |
612 movlw 0x00 | |
613 rcall PLED_DatWrite | |
614 movlw 0x71 | |
615 rcall PLED_CmdWrite | |
616 movlw 0x17 | |
617 rcall PLED_DatWrite | |
618 movlw 0x00 | |
619 rcall PLED_DatWrite | |
620 movlw 0x72 | |
621 rcall PLED_CmdWrite | |
622 movlw 0x15 | |
623 rcall PLED_DatWrite | |
624 movlw 0x80 | |
625 rcall PLED_DatWrite | |
626 | |
627 movlw 0x73 | |
628 rcall PLED_CmdWrite | |
629 movlw 0x15 | |
630 rcall PLED_DatWrite | |
631 movlw 0x11 | |
632 rcall PLED_DatWrite | |
633 movlw 0x74 | |
634 rcall PLED_CmdWrite | |
635 movlw 0x14 | |
636 rcall PLED_DatWrite | |
637 movlw 0x0B | |
638 rcall PLED_DatWrite | |
639 | |
640 movlw 0x75 | |
641 rcall PLED_CmdWrite | |
642 movlw 0x1B | |
643 rcall PLED_DatWrite | |
644 movlw 0x15 | |
645 rcall PLED_DatWrite | |
646 movlw 0x76 | |
647 rcall PLED_CmdWrite | |
648 movlw 0x13 | |
649 rcall PLED_DatWrite | |
650 movlw 0x0E | |
651 rcall PLED_DatWrite | |
652 | |
653 movlw 0x77 | |
654 rcall PLED_CmdWrite | |
655 movlw 0x1C | |
656 rcall PLED_DatWrite | |
657 movlw 0x18 | |
658 rcall PLED_DatWrite | |
659 movlw 0x78 | |
660 rcall PLED_CmdWrite | |
661 movlw 0x15 | |
662 rcall PLED_DatWrite | |
663 movlw 0x0E | |
664 rcall PLED_DatWrite | |
665 | |
666 return | |
667 | |
668 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' | |
669 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' | |
670 movff oled1_temp, oled2_temp ; Copy | |
671 | |
672 ; Mask Bit 7,6,5,4,3,2 | |
673 movlw b'00000011' | |
674 andwf oled2_temp,F | |
675 | |
676 movlw b'00000000' | |
677 dcfsnz oled2_temp,F | |
678 movlw b'01010000' | |
679 dcfsnz oled2_temp,F | |
680 movlw b'10100000' | |
681 dcfsnz oled2_temp,F | |
682 movlw b'11111000' | |
683 movwf oled3_temp ; Blue done. | |
684 | |
685 movff oled1_temp, oled2_temp ; Copy | |
686 ; Mask Bit 7,6,5,1,0 | |
687 movlw b'00011100' | |
688 andwf oled2_temp,F | |
689 rrncf oled2_temp,F | |
690 rrncf oled2_temp,F | |
691 | |
692 movlw b'00000000' | |
693 dcfsnz oled2_temp,F | |
694 movlw b'00000100' | |
695 dcfsnz oled2_temp,F | |
696 movlw b'00001000' | |
697 dcfsnz oled2_temp,F | |
698 movlw b'00001100' | |
699 dcfsnz oled2_temp,F | |
700 movlw b'00010000' | |
701 dcfsnz oled2_temp,F | |
702 movlw b'00010100' | |
703 dcfsnz oled2_temp,F | |
704 movlw b'00100000' | |
705 dcfsnz oled2_temp,F | |
706 movlw b'00111111' | |
707 movwf oled4_temp | |
708 | |
709 rrcf oled4_temp,F | |
710 rrcf oled3_temp,F | |
711 | |
712 rrcf oled4_temp,F | |
713 rrcf oled3_temp,F | |
714 | |
715 rrcf oled4_temp,F | |
716 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done. | |
717 | |
718 movff oled1_temp, oled2_temp ; Copy | |
719 clrf oled1_temp | |
720 | |
721 rrcf oled4_temp,F | |
722 rrcf oled1_temp,F | |
723 | |
724 rrcf oled4_temp,F | |
725 rrcf oled1_temp,F | |
726 | |
727 rrcf oled4_temp,F | |
728 rrcf oled1_temp,F ; Green done. | |
729 | |
730 ; Mask Bit 4,3,2,1,0 | |
731 movlw b'11100000' | |
732 andwf oled2_temp,F | |
733 | |
734 rrncf oled2_temp,F | |
735 rrncf oled2_temp,F | |
736 rrncf oled2_temp,F | |
737 rrncf oled2_temp,F | |
738 rrncf oled2_temp,F | |
739 | |
740 movlw b'00000000' | |
741 dcfsnz oled2_temp,F | |
742 movlw b'00000100' | |
743 dcfsnz oled2_temp,F | |
744 movlw b'00001000' | |
745 dcfsnz oled2_temp,F | |
746 movlw b'00001100' | |
747 dcfsnz oled2_temp,F | |
748 movlw b'00010000' | |
749 dcfsnz oled2_temp,F | |
750 movlw b'00010100' | |
751 dcfsnz oled2_temp,F | |
752 movlw b'00100000' | |
753 dcfsnz oled2_temp,F | |
754 movlw b'00111111' | |
755 movwf oled4_temp | |
756 | |
757 rrcf oled4_temp,F | |
758 rrcf oled1_temp,F | |
759 | |
760 rrcf oled4_temp,F | |
761 rrcf oled1_temp,F | |
762 | |
763 rrcf oled4_temp,F | |
764 rrcf oled1_temp,F | |
765 | |
766 rrcf oled4_temp,F | |
767 rrcf oled1_temp,F | |
768 | |
769 rrcf oled4_temp,F | |
770 rrcf oled1_temp,F ; Red done. | |
771 | |
772 movff oled1_temp,win_color1 | |
773 movff oled3_temp,win_color2 ; Set Bank0 Color registers... | |
774 return | |
775 |