Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 82:bc3092c41335
Cleaning up old wordprocessor to make it OLEDSim compatible.
author | JeanDo |
---|---|
date | Tue, 07 Dec 2010 13:22:17 +0100 |
parents | 31fa973a70fd |
children | 3e351e25f5d1 |
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! | |
53 movff win_color2,win_color2_temp | |
54 movff win_color1,win_color1_temp | |
55 call main_wordprocessor ; C-Code | |
56 movlb b'00000001' ; Back to Rambank1 | |
57 movff win_color2_temp,win_color2 | |
58 movff win_color1_temp,win_color1 | |
59 return | |
60 | |
61 ; ----------------------------- | |
62 ; PLED_SetColumnPixel: | |
63 ; ----------------------------- | |
64 PLED_SetColumnPixel: | |
65 movwf LastSetColumn ; d'0' ... d'159' | |
66 movff LastSetColumn,win_leftx2 | |
67 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
68 rcall PLED_CmdWrite | |
69 bcf STATUS,C | |
70 rlcf LastSetColumn,W ; x2 -> WREG | |
71 movlw d'0' | |
72 btfsc STATUS,C ; Result >255? | |
73 movlw d'1' ; Yes: Upper=1! | |
74 rcall PLED_DatWrite ; Upper | |
75 bcf STATUS,C | |
76 rlcf LastSetColumn,W ; x2 -> WREG | |
77 rcall PLED_DatWrite ; Lower | |
78 return | |
79 | |
80 ; ----------------------------- | |
81 ; PLED_SetRow: | |
82 ; ----------------------------- | |
83 PLED_SetRow: | |
84 movwf LastSetRow ; d'0' ... d'239' | |
85 movff LastSetRow,win_top | |
86 movlw 0x20 ; Horizontal Address START:END | |
87 rcall PLED_CmdWrite | |
88 movlw 0x00 | |
89 rcall PLED_DatWrite | |
90 movf LastSetRow,W | |
91 rcall PLED_DatWrite | |
92 return | |
93 | |
94 ; ----------------------------- | |
95 ; PLED Write Two Pixel | |
96 ; ----------------------------- | |
97 PLED_PxlWrite: | |
98 movlw 0x22 ; Start Writing Data to GRAM | |
99 rcall PLED_CmdWrite | |
100 bsf oled_rs ; Data! | |
101 movff win_color1,PORTD | |
102 bcf oled_rw | |
103 bsf oled_rw ; Upper | |
104 movff win_color2,PORTD | |
105 bcf oled_rw | |
106 bsf oled_rw ; Lower | |
107 | |
108 ; Reset Column+1 | |
109 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
110 rcall PLED_CmdWrite | |
111 bcf STATUS,C | |
112 rlcf LastSetColumn,W ; x2 | |
113 movlw d'0' | |
114 btfsc STATUS,C ; Result >256? | |
115 movlw d'1' ; Yes! | |
116 rcall PLED_DatWrite ; Upper | |
117 bcf STATUS,C | |
118 rlcf LastSetColumn,F | |
119 incf LastSetColumn,W ; x2 | |
120 rcall PLED_DatWrite ; Lower | |
121 | |
122 ; Reset Row | |
123 movlw 0x20 ; Horizontal Address START:END | |
124 rcall PLED_CmdWrite | |
125 movlw 0x00 | |
126 rcall PLED_DatWrite | |
127 movf LastSetRow,W | |
128 rcall PLED_DatWrite | |
129 | |
130 ; Write 2nd Pixel on same row but one column to the right | |
131 movlw 0x22 ; Start Writing Data to GRAM | |
132 rcall PLED_CmdWrite | |
133 bsf oled_rs ; Data! | |
134 movff win_color1,PORTD | |
135 bcf oled_rw | |
136 bsf oled_rw ; Upper | |
137 movff win_color2,PORTD | |
138 bcf oled_rw | |
139 bsf oled_rw ; Lower | |
140 return | |
141 | |
142 ; ----------------------------- | |
143 ; PLED Write One Pixel | |
144 ; ----------------------------- | |
145 PLED_PxlWrite_Single: | |
146 movlw 0x22 ; Start Writing Data to GRAM | |
147 rcall PLED_CmdWrite | |
148 bsf oled_rs ; Data! | |
149 movff win_color1, PORTD | |
150 bcf oled_rw | |
151 bsf oled_rw ; Upper | |
152 movff win_color2, PORTD | |
153 bcf oled_rw | |
154 bsf oled_rw ; Lower | |
155 return | |
156 | |
157 ; ----------------------------- | |
158 ; PLED Display Off | |
159 ; ----------------------------- | |
160 PLED_DisplayOff: | |
161 clrf PORTD | |
162 bcf oled_hv | |
163 bcf oled_vdd | |
164 bcf oled_cs | |
165 bcf oled_e_nwr | |
166 bcf oled_rw | |
167 bcf oled_nreset | |
168 return | |
169 | |
170 ; ----------------------------- | |
171 ; PLED FRAME (win_color1 and win_color2) | |
172 ; ----------------------------- | |
173 PLED_frame: | |
174 movf box_temp+0,W | |
175 call PLED_set_color | |
176 ; draw right line from row top (box_temp+1) to row bottom (box_temp+2) | |
177 movff box_temp+1,draw_box_temp1 ; Store start row | |
178 PLED_frame2: | |
179 movf draw_box_temp1,W ; d'0' ... d'239' | |
180 rcall PLED_SetRow ; Set Row | |
181 movf box_temp+3,W ; d'0' ... d'159' | |
182 call PLED_SetColumnPixel ; Set left column | |
183 rcall PLED_PxlWrite_Single ; Write Pixel | |
184 incf draw_box_temp1,F | |
185 movf draw_box_temp1,W ; Copy to W | |
186 cpfseq box_temp+2 ; Done? | |
187 bra PLED_frame2 ; Not yet... | |
188 | |
189 movf draw_box_temp1,W ; d'0' ... d'239' | |
190 rcall PLED_SetRow ; Set Row | |
191 movf box_temp+3,W ; d'0' ... d'159' | |
192 call PLED_SetColumnPixel ; Set left column | |
193 rcall PLED_PxlWrite_Single ; Write Pixel | |
194 | |
195 ; draw left line from row top (box_temp+1) to row bottom (box_temp+2) | |
196 movff box_temp+1,draw_box_temp1 ; Store start row | |
197 PLED_frame3: | |
198 movf draw_box_temp1,W ; d'0' ... d'239' | |
199 rcall PLED_SetRow ; Set Row | |
200 movf box_temp+4,W ; d'0' ... d'159' | |
201 call PLED_SetColumnPixel ; Set left column | |
202 rcall PLED_PxlWrite_Single ; Write Pixel | |
203 incf draw_box_temp1,F | |
204 movf draw_box_temp1,W ; Copy to W | |
205 cpfseq box_temp+2 ; Done? | |
206 bra PLED_frame3 ; Not yet... | |
207 | |
208 movf draw_box_temp1,W ; d'0' ... d'239' | |
209 rcall PLED_SetRow ; Set Row | |
210 movf box_temp+4,W ; d'0' ... d'159' | |
211 call PLED_SetColumnPixel ; Set left column | |
212 rcall PLED_PxlWrite_Single ; Write Pixel | |
213 | |
214 ; draw top line from box_temp+3 (0-159) to box_temp+4 (0-159) | |
215 movff box_temp+3,draw_box_temp1 ; Store start column | |
216 PLED_frame4: | |
217 movf draw_box_temp1,W ; d'0' ... d'159' | |
218 rcall PLED_SetColumnPixel ; Set Column | |
219 movf box_temp+1,W ; d'0' ... d'239' | |
220 rcall PLED_SetRow ; Set Row | |
221 rcall PLED_PxlWrite ; Write 2 Pixels | |
222 incf draw_box_temp1,F | |
223 movf draw_box_temp1,W | |
224 cpfseq box_temp+4 | |
225 bra PLED_frame4 | |
226 | |
227 ; draw bottom line from box_temp+3 (0-159) to box_temp+4 (0-159) | |
228 movff box_temp+3,draw_box_temp1 ; Store start column | |
229 PLED_frame5: | |
230 movf draw_box_temp1,W ; d'0' ... d'159' | |
231 rcall PLED_SetColumnPixel ; Set Column | |
232 movf box_temp+2,W ; d'0' ... d'239' | |
233 rcall PLED_SetRow ; Set Row | |
234 rcall PLED_PxlWrite ; Write 2 Pixels | |
235 incf draw_box_temp1,F | |
236 movf draw_box_temp1,W | |
237 cpfseq box_temp+4 | |
238 bra PLED_frame5 | |
239 | |
3 | 240 call PLED_standard_color |
0 | 241 |
242 return | |
243 | |
244 ; ----------------------------- | |
245 ; PLED Box (win_color1 and win_color2) | |
246 ; ----------------------------- | |
247 PLED_box: | |
248 movf box_temp+0,W | |
249 call PLED_set_color | |
250 ; /Define Window | |
251 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
252 rcall PLED_CmdWrite | |
253 movff box_temp+3,draw_box_temp1 | |
254 bcf STATUS,C | |
255 rlcf draw_box_temp1,W ; x2 | |
256 movlw d'0' | |
257 btfsc STATUS,C ; Result >255? | |
258 movlw d'1' ; Yes: Upper=1! | |
259 rcall PLED_DatWrite ; Upper | |
260 bcf STATUS,C | |
261 rlcf draw_box_temp1,W ; x2 -> WREG | |
262 rcall PLED_DatWrite ; Lower | |
263 | |
264 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
265 rcall PLED_CmdWrite | |
266 movff box_temp+4,draw_box_temp1 | |
267 bcf STATUS,C | |
268 rlcf draw_box_temp1,W ; x2 | |
269 movlw d'0' | |
270 btfsc STATUS,C ; Result >255? | |
271 movlw d'1' ; Yes: Upper=1! | |
272 rcall PLED_DatWrite ; Upper | |
273 bcf STATUS,C | |
274 rlcf draw_box_temp1,W ; x2 -> WREG | |
275 rcall PLED_DatWrite ; Lower | |
276 | |
277 movlw 0x37 ; HorizontalAddress START:END | |
278 rcall PLED_CmdWrite | |
279 movff box_temp+1,draw_box_temp1 | |
280 movf draw_box_temp1,W | |
281 rcall PLED_DatWrite | |
282 movff box_temp+2,draw_box_temp1 | |
283 movf draw_box_temp1,W | |
284 rcall PLED_DatWrite | |
285 | |
286 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
287 rcall PLED_CmdWrite | |
288 movlw 0x00 | |
289 rcall PLED_DatWrite | |
290 movff box_temp+1,draw_box_temp1 | |
291 movf draw_box_temp1,W | |
292 rcall PLED_DatWrite | |
293 | |
294 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
295 rcall PLED_CmdWrite | |
296 movff box_temp+3,draw_box_temp1 | |
297 bcf STATUS,C | |
298 rlcf draw_box_temp1,W ; x2 | |
299 movlw d'0' | |
300 btfsc STATUS,C ; Result >255? | |
301 movlw d'1' ; Yes: Upper=1! | |
302 rcall PLED_DatWrite ; Upper | |
303 bcf STATUS,C | |
304 rlcf draw_box_temp1,W ; x2 -> WREG | |
305 rcall PLED_DatWrite ; Lower | |
306 ; /Define Window | |
307 | |
308 ; Fill Window | |
309 movlw 0x22 ; Start Writing Data to GRAM | |
310 rcall PLED_CmdWrite | |
311 | |
312 movff box_temp+1,draw_box_temp1 | |
313 movff box_temp+2,draw_box_temp2 | |
314 movf draw_box_temp1,W | |
315 subwf draw_box_temp2,F ; X length | |
316 incf draw_box_temp2,F | |
317 | |
318 movff box_temp+3,draw_box_temp1 | |
319 movff box_temp+4,draw_box_temp3 | |
320 movf draw_box_temp1,W | |
321 subwf draw_box_temp3,F ; Y length/2 | |
322 | |
323 incf draw_box_temp3,F ; Last pixel... | |
324 | |
325 bsf oled_rs ; Data! | |
326 | |
327 PLED_box2: | |
328 movff draw_box_temp3,draw_box_temp1 | |
329 PLED_box3: | |
330 movff win_color1,PORTD | |
331 bcf oled_rw | |
332 bsf oled_rw ; Upper | |
333 movff win_color2,PORTD | |
334 bcf oled_rw | |
335 bsf oled_rw ; Lower | |
336 | |
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 decfsz draw_box_temp1,F | |
345 bra PLED_box3 | |
346 decfsz draw_box_temp2,F | |
347 bra PLED_box2 | |
348 | |
349 movlw 0x00 ; NOP, to stop Address Update Counter | |
350 rcall PLED_CmdWrite | |
351 | |
3 | 352 call PLED_standard_color |
0 | 353 return |
354 | |
355 ; ----------------------------- | |
356 ; PLED_ClearScreen: | |
357 ; ----------------------------- | |
358 PLED_ClearScreen: | |
359 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
360 rcall PLED_CmdWrite | |
361 movlw 0x00 | |
362 rcall PLED_DatWrite | |
363 movlw 0x00 | |
364 rcall PLED_DatWrite | |
365 | |
366 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
367 rcall PLED_CmdWrite | |
368 movlw 0x01 | |
369 rcall PLED_DatWrite | |
370 movlw 0x3F | |
371 rcall PLED_DatWrite | |
372 | |
373 movlw 0x37 ; HorizontalAddress START:END | |
374 rcall PLED_CmdWrite | |
375 movlw 0x00 | |
376 rcall PLED_DatWrite | |
377 movlw 0xEF | |
378 rcall PLED_DatWrite | |
379 | |
380 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
381 rcall PLED_CmdWrite | |
382 movlw 0x00 | |
383 rcall PLED_DatWrite | |
384 movlw 0x00 | |
385 rcall PLED_DatWrite | |
386 | |
387 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
388 rcall PLED_CmdWrite | |
389 movlw 0x00 | |
390 rcall PLED_DatWrite | |
391 movlw 0x00 | |
392 rcall PLED_DatWrite | |
393 | |
394 movlw 0x22 ; Start Writing Data to GRAM | |
395 rcall PLED_CmdWrite | |
396 | |
397 bsf oled_rs ; Data! | |
398 | |
399 movlw d'10' | |
400 movwf draw_box_temp3 | |
401 PLED_ClearScreen2: | |
402 movlw d'30' | |
403 movwf draw_box_temp2 | |
404 PLED_ClearScreen3: | |
405 clrf draw_box_temp1 ; 30*10*256=76800 Pixels -> Clear complete 240*320 | |
406 PLED_ClearScreen4: | |
407 | |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
408 clrf PORTD ; Need to generate trace here too. |
0 | 409 bcf oled_rw |
410 bsf oled_rw ; Upper | |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
411 |
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
412 clrf PORTD ; Need to generate trace here too. |
0 | 413 bcf oled_rw |
414 bsf oled_rw ; Lower | |
415 | |
416 decfsz draw_box_temp1,F | |
417 bra PLED_ClearScreen4 | |
418 decfsz draw_box_temp2,F | |
419 bra PLED_ClearScreen3 | |
420 decfsz draw_box_temp3,F | |
421 bra PLED_ClearScreen2 | |
422 | |
423 movlw 0x00 ; NOP, to stop Address Update Counter | |
424 rcall PLED_CmdWrite | |
425 | |
426 return | |
427 | |
428 | |
429 ; ----------------------------- | |
430 ; PLED Write Cmd via W | |
431 ; ----------------------------- | |
432 PLED_CmdWrite: | |
433 bcf oled_rs ; Command! | |
434 movwf PORTD ; Move Data to PORTD | |
435 bcf oled_rw | |
436 bsf oled_rw | |
437 return | |
438 | |
439 ; ----------------------------- | |
440 ; PLED Write Display Data via W | |
441 ; ----------------------------- | |
442 PLED_DataWrite: | |
443 | |
444 ; ----------------------------- | |
445 ; PLED Data Cmd via W | |
446 ; ----------------------------- | |
447 PLED_DatWrite: | |
448 bsf oled_rs ; Data! | |
449 movwf PORTD ; Move Data to PORTD | |
450 bcf oled_rw | |
451 bsf oled_rw | |
452 return | |
453 | |
454 ; ----------------------------- | |
455 ; PLED boot | |
456 ; ----------------------------- | |
457 PLED_boot: | |
458 bcf oled_hv | |
459 WAITMS d'32' | |
460 bsf oled_vdd | |
461 nop | |
462 bcf oled_cs | |
463 nop | |
464 bsf oled_nreset | |
3 | 465 ; WAITMS d'10' ; Quick wake-up |
466 WAITMS d'250' ; Standard wake-up | |
0 | 467 bsf oled_e_nwr |
468 nop | |
469 bcf oled_nreset | |
470 WAIT10US d'2' | |
471 bsf oled_nreset | |
472 WAITMS d'10' | |
473 | |
474 movlw 0x24 ; 80-System 8-Bit Mode | |
475 rcall PLED_CmdWrite | |
476 | |
477 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) | |
478 rcall PLED_CmdWrite | |
479 movlw 0x00 ; X X X X X X X RM | |
480 rcall PLED_DatWrite | |
481 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL | |
482 rcall PLED_DatWrite ; System Interface: RIM is ignored, Internal Clock | |
483 | |
484 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | |
485 rcall PLED_CmdWrite | |
486 movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color | |
487 rcall PLED_DatWrite | |
488 movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM | |
489 rcall PLED_DatWrite | |
490 | |
491 movlw 0x18 | |
492 rcall PLED_CmdWrite | |
493 movlw 0x00 | |
494 rcall PLED_DatWrite | |
495 movlw 0x28 | |
496 rcall PLED_DatWrite | |
497 | |
498 movlw 0xF8 | |
499 rcall PLED_CmdWrite | |
500 movlw 0x00 | |
501 rcall PLED_DatWrite | |
502 movlw 0x0F | |
503 rcall PLED_DatWrite | |
504 | |
505 movlw 0xF9 | |
506 rcall PLED_CmdWrite | |
507 movlw 0x00 | |
508 rcall PLED_DatWrite | |
509 movlw 0x0F | |
510 rcall PLED_DatWrite | |
511 | |
512 movlw 0x10 | |
513 rcall PLED_CmdWrite | |
514 movlw 0x00 | |
515 rcall PLED_DatWrite | |
516 movlw 0x00 | |
517 rcall PLED_DatWrite | |
518 | |
519 ; Now Gamma settings... | |
520 rcall PLED_brightness_full | |
2 | 521 ;rcall PLED_brightness_low |
0 | 522 ; End Gamma Settings |
523 | |
524 rcall PLED_ClearScreen | |
525 | |
526 bsf oled_hv | |
527 WAITMS d'32' | |
528 | |
529 movlw 0x05 | |
530 rcall PLED_CmdWrite | |
531 movlw 0x00 | |
532 rcall PLED_DatWrite | |
533 movlw 0x01 | |
534 rcall PLED_DatWrite ; Display ON | |
535 return | |
536 | |
537 | |
538 PLED_brightness_full: | |
539 movlw 0x70 | |
540 rcall PLED_CmdWrite | |
541 movlw 0x1F | |
542 rcall PLED_DatWrite | |
543 movlw 0x00 | |
544 rcall PLED_DatWrite | |
545 movlw 0x71 | |
546 rcall PLED_CmdWrite | |
547 movlw 0x23 | |
548 rcall PLED_DatWrite | |
549 movlw 0x80 | |
550 rcall PLED_DatWrite | |
551 movlw 0x72 | |
552 rcall PLED_CmdWrite | |
553 movlw 0x2A | |
554 rcall PLED_DatWrite | |
555 movlw 0x80 | |
556 rcall PLED_DatWrite | |
557 | |
558 movlw 0x73 | |
559 rcall PLED_CmdWrite | |
560 movlw 0x15 | |
561 rcall PLED_DatWrite | |
562 movlw 0x11 | |
563 rcall PLED_DatWrite | |
564 movlw 0x74 | |
565 rcall PLED_CmdWrite | |
566 movlw 0x1C | |
567 rcall PLED_DatWrite | |
568 movlw 0x11 | |
569 rcall PLED_DatWrite | |
570 | |
571 movlw 0x75 | |
572 rcall PLED_CmdWrite | |
573 movlw 0x1B | |
574 rcall PLED_DatWrite | |
575 movlw 0x15 | |
576 rcall PLED_DatWrite | |
577 movlw 0x76 | |
578 rcall PLED_CmdWrite | |
579 movlw 0x1A | |
580 rcall PLED_DatWrite | |
581 movlw 0x15 | |
582 rcall PLED_DatWrite | |
583 | |
584 movlw 0x77 | |
585 rcall PLED_CmdWrite | |
586 movlw 0x1C | |
587 rcall PLED_DatWrite | |
588 movlw 0x18 | |
589 rcall PLED_DatWrite | |
590 movlw 0x78 | |
591 rcall PLED_CmdWrite | |
592 movlw 0x21 | |
593 rcall PLED_DatWrite | |
594 movlw 0x15 | |
595 rcall PLED_DatWrite | |
596 | |
597 return | |
598 | |
599 PLED_brightness_low: | |
600 movlw 0x70 | |
601 rcall PLED_CmdWrite | |
602 movlw 0x14 | |
603 rcall PLED_DatWrite | |
604 movlw 0x00 | |
605 rcall PLED_DatWrite | |
606 movlw 0x71 | |
607 rcall PLED_CmdWrite | |
608 movlw 0x17 | |
609 rcall PLED_DatWrite | |
610 movlw 0x00 | |
611 rcall PLED_DatWrite | |
612 movlw 0x72 | |
613 rcall PLED_CmdWrite | |
614 movlw 0x15 | |
615 rcall PLED_DatWrite | |
616 movlw 0x80 | |
617 rcall PLED_DatWrite | |
618 | |
619 movlw 0x73 | |
620 rcall PLED_CmdWrite | |
621 movlw 0x15 | |
622 rcall PLED_DatWrite | |
623 movlw 0x11 | |
624 rcall PLED_DatWrite | |
625 movlw 0x74 | |
626 rcall PLED_CmdWrite | |
627 movlw 0x14 | |
628 rcall PLED_DatWrite | |
629 movlw 0x0B | |
630 rcall PLED_DatWrite | |
631 | |
632 movlw 0x75 | |
633 rcall PLED_CmdWrite | |
634 movlw 0x1B | |
635 rcall PLED_DatWrite | |
636 movlw 0x15 | |
637 rcall PLED_DatWrite | |
638 movlw 0x76 | |
639 rcall PLED_CmdWrite | |
640 movlw 0x13 | |
641 rcall PLED_DatWrite | |
642 movlw 0x0E | |
643 rcall PLED_DatWrite | |
644 | |
645 movlw 0x77 | |
646 rcall PLED_CmdWrite | |
647 movlw 0x1C | |
648 rcall PLED_DatWrite | |
649 movlw 0x18 | |
650 rcall PLED_DatWrite | |
651 movlw 0x78 | |
652 rcall PLED_CmdWrite | |
653 movlw 0x15 | |
654 rcall PLED_DatWrite | |
655 movlw 0x0E | |
656 rcall PLED_DatWrite | |
657 | |
658 return | |
659 | |
660 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' | |
661 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' | |
662 movff oled1_temp, oled2_temp ; Copy | |
663 | |
664 ; Mask Bit 7,6,5,4,3,2 | |
665 movlw b'00000011' | |
666 andwf oled2_temp,F | |
667 | |
668 movlw b'00000000' | |
669 dcfsnz oled2_temp,F | |
670 movlw b'01010000' | |
671 dcfsnz oled2_temp,F | |
672 movlw b'10100000' | |
673 dcfsnz oled2_temp,F | |
674 movlw b'11111000' | |
675 movwf oled3_temp ; Blue done. | |
676 | |
677 movff oled1_temp, oled2_temp ; Copy | |
678 ; Mask Bit 7,6,5,1,0 | |
679 movlw b'00011100' | |
680 andwf oled2_temp,F | |
681 rrncf oled2_temp,F | |
682 rrncf oled2_temp,F | |
683 | |
684 movlw b'00000000' | |
685 dcfsnz oled2_temp,F | |
686 movlw b'00000100' | |
687 dcfsnz oled2_temp,F | |
688 movlw b'00001000' | |
689 dcfsnz oled2_temp,F | |
690 movlw b'00001100' | |
691 dcfsnz oled2_temp,F | |
692 movlw b'00010000' | |
693 dcfsnz oled2_temp,F | |
694 movlw b'00010100' | |
695 dcfsnz oled2_temp,F | |
696 movlw b'00100000' | |
697 dcfsnz oled2_temp,F | |
698 movlw b'00111111' | |
699 movwf oled4_temp | |
700 | |
701 rrcf oled4_temp,F | |
702 rrcf oled3_temp,F | |
703 | |
704 rrcf oled4_temp,F | |
705 rrcf oled3_temp,F | |
706 | |
707 rrcf oled4_temp,F | |
708 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done. | |
709 | |
710 movff oled1_temp, oled2_temp ; Copy | |
711 clrf oled1_temp | |
712 | |
713 rrcf oled4_temp,F | |
714 rrcf oled1_temp,F | |
715 | |
716 rrcf oled4_temp,F | |
717 rrcf oled1_temp,F | |
718 | |
719 rrcf oled4_temp,F | |
720 rrcf oled1_temp,F ; Green done. | |
721 | |
722 ; Mask Bit 4,3,2,1,0 | |
723 movlw b'11100000' | |
724 andwf oled2_temp,F | |
725 | |
726 rrncf oled2_temp,F | |
727 rrncf oled2_temp,F | |
728 rrncf oled2_temp,F | |
729 rrncf oled2_temp,F | |
730 rrncf oled2_temp,F | |
731 | |
732 movlw b'00000000' | |
733 dcfsnz oled2_temp,F | |
734 movlw b'00000100' | |
735 dcfsnz oled2_temp,F | |
736 movlw b'00001000' | |
737 dcfsnz oled2_temp,F | |
738 movlw b'00001100' | |
739 dcfsnz oled2_temp,F | |
740 movlw b'00010000' | |
741 dcfsnz oled2_temp,F | |
742 movlw b'00010100' | |
743 dcfsnz oled2_temp,F | |
744 movlw b'00100000' | |
745 dcfsnz oled2_temp,F | |
746 movlw b'00111111' | |
747 movwf oled4_temp | |
748 | |
749 rrcf oled4_temp,F | |
750 rrcf oled1_temp,F | |
751 | |
752 rrcf oled4_temp,F | |
753 rrcf oled1_temp,F | |
754 | |
755 rrcf oled4_temp,F | |
756 rrcf oled1_temp,F | |
757 | |
758 rrcf oled4_temp,F | |
759 rrcf oled1_temp,F | |
760 | |
761 rrcf oled4_temp,F | |
762 rrcf oled1_temp,F ; Red done. | |
763 | |
764 movff oled1_temp,win_color1 | |
765 movff oled3_temp,win_color2 ; Set Bank0 Color registers... | |
766 return | |
767 |