Mercurial > public > mk2
comparison code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 0:96a35aeda5f2
Initial setup
author | heinrichsweikamp |
---|---|
date | Tue, 12 Jan 2010 15:05:59 +0100 |
parents | |
children | d11ef8dc4b2c |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:96a35aeda5f2 |
---|---|
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 | |
240 movlw color_white | |
241 call PLED_set_color | |
242 | |
243 return | |
244 | |
245 ; ----------------------------- | |
246 ; PLED Box (win_color1 and win_color2) | |
247 ; ----------------------------- | |
248 PLED_box: | |
249 movf box_temp+0,W | |
250 call PLED_set_color | |
251 ; /Define Window | |
252 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
253 rcall PLED_CmdWrite | |
254 movff box_temp+3,draw_box_temp1 | |
255 bcf STATUS,C | |
256 rlcf draw_box_temp1,W ; x2 | |
257 movlw d'0' | |
258 btfsc STATUS,C ; Result >255? | |
259 movlw d'1' ; Yes: Upper=1! | |
260 rcall PLED_DatWrite ; Upper | |
261 bcf STATUS,C | |
262 rlcf draw_box_temp1,W ; x2 -> WREG | |
263 rcall PLED_DatWrite ; Lower | |
264 | |
265 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
266 rcall PLED_CmdWrite | |
267 movff box_temp+4,draw_box_temp1 | |
268 bcf STATUS,C | |
269 rlcf draw_box_temp1,W ; x2 | |
270 movlw d'0' | |
271 btfsc STATUS,C ; Result >255? | |
272 movlw d'1' ; Yes: Upper=1! | |
273 rcall PLED_DatWrite ; Upper | |
274 bcf STATUS,C | |
275 rlcf draw_box_temp1,W ; x2 -> WREG | |
276 rcall PLED_DatWrite ; Lower | |
277 | |
278 movlw 0x37 ; HorizontalAddress START:END | |
279 rcall PLED_CmdWrite | |
280 movff box_temp+1,draw_box_temp1 | |
281 movf draw_box_temp1,W | |
282 rcall PLED_DatWrite | |
283 movff box_temp+2,draw_box_temp1 | |
284 movf draw_box_temp1,W | |
285 rcall PLED_DatWrite | |
286 | |
287 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
288 rcall PLED_CmdWrite | |
289 movlw 0x00 | |
290 rcall PLED_DatWrite | |
291 movff box_temp+1,draw_box_temp1 | |
292 movf draw_box_temp1,W | |
293 rcall PLED_DatWrite | |
294 | |
295 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
296 rcall PLED_CmdWrite | |
297 movff box_temp+3,draw_box_temp1 | |
298 bcf STATUS,C | |
299 rlcf draw_box_temp1,W ; x2 | |
300 movlw d'0' | |
301 btfsc STATUS,C ; Result >255? | |
302 movlw d'1' ; Yes: Upper=1! | |
303 rcall PLED_DatWrite ; Upper | |
304 bcf STATUS,C | |
305 rlcf draw_box_temp1,W ; x2 -> WREG | |
306 rcall PLED_DatWrite ; Lower | |
307 ; /Define Window | |
308 | |
309 ; Fill Window | |
310 movlw 0x22 ; Start Writing Data to GRAM | |
311 rcall PLED_CmdWrite | |
312 | |
313 movff box_temp+1,draw_box_temp1 | |
314 movff box_temp+2,draw_box_temp2 | |
315 movf draw_box_temp1,W | |
316 subwf draw_box_temp2,F ; X length | |
317 incf draw_box_temp2,F | |
318 | |
319 movff box_temp+3,draw_box_temp1 | |
320 movff box_temp+4,draw_box_temp3 | |
321 movf draw_box_temp1,W | |
322 subwf draw_box_temp3,F ; Y length/2 | |
323 | |
324 incf draw_box_temp3,F ; Last pixel... | |
325 | |
326 bsf oled_rs ; Data! | |
327 | |
328 PLED_box2: | |
329 movff draw_box_temp3,draw_box_temp1 | |
330 PLED_box3: | |
331 movff win_color1,PORTD | |
332 bcf oled_rw | |
333 bsf oled_rw ; Upper | |
334 movff win_color2,PORTD | |
335 bcf oled_rw | |
336 bsf oled_rw ; Lower | |
337 | |
338 movff win_color1,PORTD | |
339 bcf oled_rw | |
340 bsf oled_rw ; Upper | |
341 movff win_color2,PORTD | |
342 bcf oled_rw | |
343 bsf oled_rw ; Lower | |
344 | |
345 decfsz draw_box_temp1,F | |
346 bra PLED_box3 | |
347 decfsz draw_box_temp2,F | |
348 bra PLED_box2 | |
349 | |
350 movlw 0x00 ; NOP, to stop Address Update Counter | |
351 rcall PLED_CmdWrite | |
352 | |
353 movlw color_white | |
354 call PLED_set_color | |
355 return | |
356 | |
357 | |
358 ; ----------------------------- | |
359 ; PLED_ClearScreen: | |
360 ; ----------------------------- | |
361 PLED_ClearScreen: | |
362 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
363 rcall PLED_CmdWrite | |
364 movlw 0x00 | |
365 rcall PLED_DatWrite | |
366 movlw 0x00 | |
367 rcall PLED_DatWrite | |
368 | |
369 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
370 rcall PLED_CmdWrite | |
371 movlw 0x01 | |
372 rcall PLED_DatWrite | |
373 movlw 0x3F | |
374 rcall PLED_DatWrite | |
375 | |
376 movlw 0x37 ; HorizontalAddress START:END | |
377 rcall PLED_CmdWrite | |
378 movlw 0x00 | |
379 rcall PLED_DatWrite | |
380 movlw 0xEF | |
381 rcall PLED_DatWrite | |
382 | |
383 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
384 rcall PLED_CmdWrite | |
385 movlw 0x00 | |
386 rcall PLED_DatWrite | |
387 movlw 0x00 | |
388 rcall PLED_DatWrite | |
389 | |
390 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
391 rcall PLED_CmdWrite | |
392 movlw 0x00 | |
393 rcall PLED_DatWrite | |
394 movlw 0x00 | |
395 rcall PLED_DatWrite | |
396 | |
397 movlw 0x22 ; Start Writing Data to GRAM | |
398 rcall PLED_CmdWrite | |
399 | |
400 bsf oled_rs ; Data! | |
401 | |
402 clrf PORTD ; See Page 101 of OLED Driver IC Datasheet | |
403 | |
404 movlw d'10' | |
405 movwf draw_box_temp3 | |
406 PLED_ClearScreen2: | |
407 movlw d'30' | |
408 movwf draw_box_temp2 | |
409 PLED_ClearScreen3: | |
410 clrf draw_box_temp1 ; 30*10*256=76800 Pixels -> Clear complete 240*320 | |
411 PLED_ClearScreen4: | |
412 | |
413 bcf oled_rw | |
414 bsf oled_rw ; Upper | |
415 bcf oled_rw | |
416 bsf oled_rw ; Lower | |
417 | |
418 decfsz draw_box_temp1,F | |
419 bra PLED_ClearScreen4 | |
420 decfsz draw_box_temp2,F | |
421 bra PLED_ClearScreen3 | |
422 decfsz draw_box_temp3,F | |
423 bra PLED_ClearScreen2 | |
424 | |
425 movlw 0x00 ; NOP, to stop Address Update Counter | |
426 rcall PLED_CmdWrite | |
427 | |
428 return | |
429 | |
430 | |
431 ; ----------------------------- | |
432 ; PLED Write Cmd via W | |
433 ; ----------------------------- | |
434 PLED_CmdWrite: | |
435 bcf oled_rs ; Command! | |
436 movwf PORTD ; Move Data to PORTD | |
437 bcf oled_rw | |
438 bsf oled_rw | |
439 return | |
440 | |
441 ; ----------------------------- | |
442 ; PLED Write Display Data via W | |
443 ; ----------------------------- | |
444 PLED_DataWrite: | |
445 | |
446 ; ----------------------------- | |
447 ; PLED Data Cmd via W | |
448 ; ----------------------------- | |
449 PLED_DatWrite: | |
450 bsf oled_rs ; Data! | |
451 movwf PORTD ; Move Data to PORTD | |
452 bcf oled_rw | |
453 bsf oled_rw | |
454 return | |
455 | |
456 ; ----------------------------- | |
457 ; PLED boot | |
458 ; ----------------------------- | |
459 PLED_boot: | |
460 bcf oled_hv | |
461 WAITMS d'32' | |
462 bsf oled_vdd | |
463 nop | |
464 bcf oled_cs | |
465 nop | |
466 bsf oled_nreset | |
467 WAITMS d'10' ; Quick wake-up | |
468 ; WAITMS d'250' | |
469 bsf oled_e_nwr | |
470 nop | |
471 bcf oled_nreset | |
472 WAIT10US d'2' | |
473 bsf oled_nreset | |
474 WAITMS d'10' | |
475 | |
476 movlw 0x24 ; 80-System 8-Bit Mode | |
477 rcall PLED_CmdWrite | |
478 | |
479 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) | |
480 rcall PLED_CmdWrite | |
481 movlw 0x00 ; X X X X X X X RM | |
482 rcall PLED_DatWrite | |
483 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL | |
484 rcall PLED_DatWrite ; System Interface: RIM is ignored, Internal Clock | |
485 | |
486 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | |
487 rcall PLED_CmdWrite | |
488 movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color | |
489 rcall PLED_DatWrite | |
490 movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM | |
491 rcall PLED_DatWrite | |
492 | |
493 movlw 0x18 | |
494 rcall PLED_CmdWrite | |
495 movlw 0x00 | |
496 rcall PLED_DatWrite | |
497 movlw 0x28 | |
498 rcall PLED_DatWrite | |
499 | |
500 movlw 0xF8 | |
501 rcall PLED_CmdWrite | |
502 movlw 0x00 | |
503 rcall PLED_DatWrite | |
504 movlw 0x0F | |
505 rcall PLED_DatWrite | |
506 | |
507 movlw 0xF9 | |
508 rcall PLED_CmdWrite | |
509 movlw 0x00 | |
510 rcall PLED_DatWrite | |
511 movlw 0x0F | |
512 rcall PLED_DatWrite | |
513 | |
514 movlw 0x10 | |
515 rcall PLED_CmdWrite | |
516 movlw 0x00 | |
517 rcall PLED_DatWrite | |
518 movlw 0x00 | |
519 rcall PLED_DatWrite | |
520 | |
521 ; Now Gamma settings... | |
522 rcall PLED_brightness_full | |
523 ; End Gamma Settings | |
524 | |
525 rcall PLED_ClearScreen | |
526 | |
527 bsf oled_hv | |
528 WAITMS d'32' | |
529 | |
530 movlw 0x05 | |
531 rcall PLED_CmdWrite | |
532 movlw 0x00 | |
533 rcall PLED_DatWrite | |
534 movlw 0x01 | |
535 rcall PLED_DatWrite ; Display ON | |
536 return | |
537 | |
538 | |
539 PLED_brightness_full: | |
540 movlw 0x70 | |
541 rcall PLED_CmdWrite | |
542 movlw 0x1F | |
543 rcall PLED_DatWrite | |
544 movlw 0x00 | |
545 rcall PLED_DatWrite | |
546 movlw 0x71 | |
547 rcall PLED_CmdWrite | |
548 movlw 0x23 | |
549 rcall PLED_DatWrite | |
550 movlw 0x80 | |
551 rcall PLED_DatWrite | |
552 movlw 0x72 | |
553 rcall PLED_CmdWrite | |
554 movlw 0x2A | |
555 rcall PLED_DatWrite | |
556 movlw 0x80 | |
557 rcall PLED_DatWrite | |
558 | |
559 movlw 0x73 | |
560 rcall PLED_CmdWrite | |
561 movlw 0x15 | |
562 rcall PLED_DatWrite | |
563 movlw 0x11 | |
564 rcall PLED_DatWrite | |
565 movlw 0x74 | |
566 rcall PLED_CmdWrite | |
567 movlw 0x1C | |
568 rcall PLED_DatWrite | |
569 movlw 0x11 | |
570 rcall PLED_DatWrite | |
571 | |
572 movlw 0x75 | |
573 rcall PLED_CmdWrite | |
574 movlw 0x1B | |
575 rcall PLED_DatWrite | |
576 movlw 0x15 | |
577 rcall PLED_DatWrite | |
578 movlw 0x76 | |
579 rcall PLED_CmdWrite | |
580 movlw 0x1A | |
581 rcall PLED_DatWrite | |
582 movlw 0x15 | |
583 rcall PLED_DatWrite | |
584 | |
585 movlw 0x77 | |
586 rcall PLED_CmdWrite | |
587 movlw 0x1C | |
588 rcall PLED_DatWrite | |
589 movlw 0x18 | |
590 rcall PLED_DatWrite | |
591 movlw 0x78 | |
592 rcall PLED_CmdWrite | |
593 movlw 0x21 | |
594 rcall PLED_DatWrite | |
595 movlw 0x15 | |
596 rcall PLED_DatWrite | |
597 | |
598 return | |
599 | |
600 PLED_brightness_low: | |
601 movlw 0x70 | |
602 rcall PLED_CmdWrite | |
603 movlw 0x14 | |
604 rcall PLED_DatWrite | |
605 movlw 0x00 | |
606 rcall PLED_DatWrite | |
607 movlw 0x71 | |
608 rcall PLED_CmdWrite | |
609 movlw 0x17 | |
610 rcall PLED_DatWrite | |
611 movlw 0x00 | |
612 rcall PLED_DatWrite | |
613 movlw 0x72 | |
614 rcall PLED_CmdWrite | |
615 movlw 0x15 | |
616 rcall PLED_DatWrite | |
617 movlw 0x80 | |
618 rcall PLED_DatWrite | |
619 | |
620 movlw 0x73 | |
621 rcall PLED_CmdWrite | |
622 movlw 0x15 | |
623 rcall PLED_DatWrite | |
624 movlw 0x11 | |
625 rcall PLED_DatWrite | |
626 movlw 0x74 | |
627 rcall PLED_CmdWrite | |
628 movlw 0x14 | |
629 rcall PLED_DatWrite | |
630 movlw 0x0B | |
631 rcall PLED_DatWrite | |
632 | |
633 movlw 0x75 | |
634 rcall PLED_CmdWrite | |
635 movlw 0x1B | |
636 rcall PLED_DatWrite | |
637 movlw 0x15 | |
638 rcall PLED_DatWrite | |
639 movlw 0x76 | |
640 rcall PLED_CmdWrite | |
641 movlw 0x13 | |
642 rcall PLED_DatWrite | |
643 movlw 0x0E | |
644 rcall PLED_DatWrite | |
645 | |
646 movlw 0x77 | |
647 rcall PLED_CmdWrite | |
648 movlw 0x1C | |
649 rcall PLED_DatWrite | |
650 movlw 0x18 | |
651 rcall PLED_DatWrite | |
652 movlw 0x78 | |
653 rcall PLED_CmdWrite | |
654 movlw 0x15 | |
655 rcall PLED_DatWrite | |
656 movlw 0x0E | |
657 rcall PLED_DatWrite | |
658 | |
659 return | |
660 | |
661 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' | |
662 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' | |
663 movff oled1_temp, oled2_temp ; Copy | |
664 | |
665 ; Mask Bit 7,6,5,4,3,2 | |
666 movlw b'00000011' | |
667 andwf oled2_temp,F | |
668 | |
669 movlw b'00000000' | |
670 dcfsnz oled2_temp,F | |
671 movlw b'01010000' | |
672 dcfsnz oled2_temp,F | |
673 movlw b'10100000' | |
674 dcfsnz oled2_temp,F | |
675 movlw b'11111000' | |
676 movwf oled3_temp ; Blue done. | |
677 | |
678 movff oled1_temp, oled2_temp ; Copy | |
679 ; Mask Bit 7,6,5,1,0 | |
680 movlw b'00011100' | |
681 andwf oled2_temp,F | |
682 rrncf oled2_temp,F | |
683 rrncf oled2_temp,F | |
684 | |
685 movlw b'00000000' | |
686 dcfsnz oled2_temp,F | |
687 movlw b'00000100' | |
688 dcfsnz oled2_temp,F | |
689 movlw b'00001000' | |
690 dcfsnz oled2_temp,F | |
691 movlw b'00001100' | |
692 dcfsnz oled2_temp,F | |
693 movlw b'00010000' | |
694 dcfsnz oled2_temp,F | |
695 movlw b'00010100' | |
696 dcfsnz oled2_temp,F | |
697 movlw b'00100000' | |
698 dcfsnz oled2_temp,F | |
699 movlw b'00111111' | |
700 movwf oled4_temp | |
701 | |
702 rrcf oled4_temp,F | |
703 rrcf oled3_temp,F | |
704 | |
705 rrcf oled4_temp,F | |
706 rrcf oled3_temp,F | |
707 | |
708 rrcf oled4_temp,F | |
709 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done. | |
710 | |
711 movff oled1_temp, oled2_temp ; Copy | |
712 clrf oled1_temp | |
713 | |
714 rrcf oled4_temp,F | |
715 rrcf oled1_temp,F | |
716 | |
717 rrcf oled4_temp,F | |
718 rrcf oled1_temp,F | |
719 | |
720 rrcf oled4_temp,F | |
721 rrcf oled1_temp,F ; Green done. | |
722 | |
723 ; Mask Bit 4,3,2,1,0 | |
724 movlw b'11100000' | |
725 andwf oled2_temp,F | |
726 | |
727 rrncf oled2_temp,F | |
728 rrncf oled2_temp,F | |
729 rrncf oled2_temp,F | |
730 rrncf oled2_temp,F | |
731 rrncf oled2_temp,F | |
732 | |
733 movlw b'00000000' | |
734 dcfsnz oled2_temp,F | |
735 movlw b'00000100' | |
736 dcfsnz oled2_temp,F | |
737 movlw b'00001000' | |
738 dcfsnz oled2_temp,F | |
739 movlw b'00001100' | |
740 dcfsnz oled2_temp,F | |
741 movlw b'00010000' | |
742 dcfsnz oled2_temp,F | |
743 movlw b'00010100' | |
744 dcfsnz oled2_temp,F | |
745 movlw b'00100000' | |
746 dcfsnz oled2_temp,F | |
747 movlw b'00111111' | |
748 movwf oled4_temp | |
749 | |
750 rrcf oled4_temp,F | |
751 rrcf oled1_temp,F | |
752 | |
753 rrcf oled4_temp,F | |
754 rrcf oled1_temp,F | |
755 | |
756 rrcf oled4_temp,F | |
757 rrcf oled1_temp,F | |
758 | |
759 rrcf oled4_temp,F | |
760 rrcf oled1_temp,F | |
761 | |
762 rrcf oled4_temp,F | |
763 rrcf oled1_temp,F ; Red done. | |
764 | |
765 movff oled1_temp,win_color1 | |
766 movff oled3_temp,win_color2 ; Set Bank0 Color registers... | |
767 return | |
768 |