Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 142:8b75ba28d641
Screen-flipping custom function.
- Fix bank safe addressings.
author | JeanDo |
---|---|
date | Fri, 07 Jan 2011 03:01:02 +0100 |
parents | d721b49b8934 |
children | c09b0be2e1e6 |
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 | |
142 | 21 ; History: |
22 ; 2009-08-30: [MH] last updated. | |
23 ; 2011-01-07: [jDG] Added flip_screen option | |
24 ; known bugs: pixel-write (loogbok curves) not done yet... | |
25 ; ToDo: | |
0 | 26 |
27 WIN_FONT macro win_font_input | |
28 movlw win_font_input | |
29 movff WREG,win_font | |
30 endm | |
31 | |
32 WIN_TOP macro win_top_input | |
33 movlw win_top_input | |
34 movff WREG,win_top | |
35 endm | |
36 | |
37 WIN_LEFT macro win_left_input | |
38 movlw win_left_input | |
39 movff WREG,win_leftx2 | |
40 endm | |
41 | |
42 WIN_INVERT macro win_invert_input | |
43 movlw win_invert_input | |
44 movff WREG,win_invert | |
45 endm | |
46 | |
47 WIN_COLOR macro win_color_input | |
48 movlw win_color_input | |
49 call PLED_set_color | |
50 endm | |
142 | 51 |
52 ;============================================================================= | |
53 | |
0 | 54 word_processor: ; word_processor: |
142 | 55 clrf POSTINC2 ; Required, to mark end of string. |
56 call aa_wordprocessor | |
57 movlb b'00000001' ; Back to Rambank1 | |
58 return | |
0 | 59 |
142 | 60 ;============================================================================= |
0 | 61 ; PLED_SetColumnPixel: |
142 | 62 ; |
0 | 63 PLED_SetColumnPixel: |
142 | 64 movff WREG,win_leftx2 ; d'0' ... d'159' |
65 mullw 2 ; Copy to PROD, times 2. | |
123 | 66 |
142 | 67 movlw 0x21 ; Start Address Vertical (.0 - .319) |
0 | 68 rcall PLED_CmdWrite |
123 | 69 bra PLED_DataWrite_PROD |
0 | 70 |
142 | 71 ;============================================================================= |
0 | 72 ; PLED_SetRow: |
123 | 73 ; Backup WREG --> win_top, for the next write pixel. |
74 ; Setup OLED pixel horizontal address. | |
142 | 75 ; |
0 | 76 PLED_SetRow: |
123 | 77 movff WREG,win_top ; d'0' ... d'239' |
78 mullw 1 ; Copy row to PRODH:L | |
0 | 79 movlw 0x20 ; Horizontal Address START:END |
80 rcall PLED_CmdWrite | |
123 | 81 bra PLED_DataWrite_PROD |
0 | 82 |
142 | 83 ;============================================================================= |
0 | 84 ; PLED Write Two Pixel |
142 | 85 ; |
123 | 86 |
0 | 87 PLED_PxlWrite: |
123 | 88 rcall PLED_PxlWrite_Single ; Write first pixel. |
0 | 89 |
123 | 90 ; Write 2nd Pixel on same row but one column to the right |
130 | 91 movff win_top,WREG |
92 rcall PLED_SetRow ; Re-Set Row | |
93 movff win_leftx2,WREG ; Increment column address. | |
123 | 94 mullw 2 |
95 incf PRODL | |
96 clrf WREG ; Does not reset CARRY... | |
97 addwfc PRODH | |
0 | 98 movlw 0x21 ; Start Address Vertical (.0 - .319) |
99 rcall PLED_CmdWrite | |
123 | 100 rcall PLED_DataWrite_PROD |
101 ; Continue with PLED_PxlWrite_Single... | |
0 | 102 |
103 ; ----------------------------- | |
104 ; PLED Write One Pixel | |
105 ; ----------------------------- | |
106 PLED_PxlWrite_Single: | |
107 movlw 0x22 ; Start Writing Data to GRAM | |
108 rcall PLED_CmdWrite | |
109 bsf oled_rs ; Data! | |
110 movff win_color1, PORTD | |
111 bcf oled_rw | |
112 bsf oled_rw ; Upper | |
113 movff win_color2, PORTD | |
114 bcf oled_rw | |
115 bsf oled_rw ; Lower | |
116 return | |
117 | |
118 ; ----------------------------- | |
119 ; PLED Display Off | |
120 ; ----------------------------- | |
121 PLED_DisplayOff: | |
122 clrf PORTD | |
123 bcf oled_hv | |
124 bcf oled_vdd | |
125 bcf oled_cs | |
126 bcf oled_e_nwr | |
127 bcf oled_rw | |
128 bcf oled_nreset | |
129 return | |
130 | |
123 | 131 ;============================================================================= |
142 | 132 ; Fast macros to write to OLED display. |
133 ; Adding a call/return adds 3 words and a pipeline flush, hence make it | |
134 ; nearly twice slower... | |
135 ; | |
136 ; Input : commande as macro parameter. | |
137 ; Output : NONE | |
138 ; Trash : WREG | |
139 ; | |
140 AA_CMD_WRITE macro cmd | |
141 movlw cmd | |
142 rcall PLED_CmdWrite | |
143 ; bcf oled_rs ; Cmd mode | |
144 ; movwf PORTD,A | |
145 ; bcf oled_rw ; Tick the clock | |
146 ; bsf oled_rw | |
147 endm | |
148 ; | |
149 ; Input : PRODH:L as 16bits data. | |
150 ; Output : NONE | |
151 ; Trash : NONE | |
152 ; | |
153 AA_DATA_WRITE_PROD macro | |
154 rcall PLED_DataWrite_PROD | |
155 ; bsf oled_rs ; Data mode | |
156 ; movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN! | |
157 ; bcf oled_rw ; Tick the clock | |
158 ; bsf oled_rw | |
159 ; movff PRODL,PORTD | |
160 ; bcf oled_rw ; Tick the clock | |
161 ; bsf oled_rw | |
162 endm | |
163 | |
164 ;============================================================================= | |
165 ; Output OLED Window Address commands. | |
166 ; Inputs : win_top, win_leftx2, win_height, aa_width. | |
167 ; Output : PortD commands. | |
168 ; Trashed: PROD | |
169 ; | |
170 PLED_box_write: | |
171 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD | |
172 mullw 2 | |
173 | |
174 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
175 btfsc WREG,0 ; 180° rotation ? | |
176 bra PLED_box_flip_H ; YES: | |
177 | |
178 ;---- Normal horizontal window --------------------------------------- | |
179 ; Output 0x35 left, | |
180 ; 0x36 right == left + width - 1. | |
181 AA_CMD_WRITE 0x35 ; this is the left border | |
182 AA_DATA_WRITE_PROD ; Output left | |
183 AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord. | |
184 AA_DATA_WRITE_PROD | |
185 | |
186 movf aa_width+0,W,ACCESS ; right = left + width - 1 | |
187 addwf PRODL,F | |
188 movf aa_width+1,W,ACCESS | |
189 addwfc PRODH,F | |
190 decf PRODL,F,A ; decrement result | |
191 btfss STATUS,C | |
192 decf PRODH,F,A | |
193 | |
194 AA_CMD_WRITE 0x36 ; Write and the right border | |
195 AA_DATA_WRITE_PROD | |
196 | |
197 bra PLED_box_noflip_H | |
198 | |
199 ;---- Flipped horizontal window -------------------------------------- | |
200 PLED_box_flip_H: | |
201 ; Output 0x36 flipped(left) = 319-left | |
202 ; 0x35 flipped(right) = 319-right = 320 - left - width | |
203 movf PRODL,W ; 16bits 319 - PROD --> PROD | |
204 sublw LOW(.319) ; 319-W --> W | |
205 movwf PRODL | |
206 movf PRODH,W | |
207 btfss STATUS,C ; Borrow = /CARRY | |
208 incf WREG | |
209 sublw HIGH(.319) | |
210 movwf PRODH | |
211 AA_CMD_WRITE 0x36 ; this is the left border | |
212 AA_DATA_WRITE_PROD ; Output left | |
213 AA_CMD_WRITE 0x21 | |
214 AA_DATA_WRITE_PROD | |
215 | |
216 movf aa_width+0,W ; 16bits PROD - width --> PROD | |
217 subwf PRODL,F ; PRODL - WREG --> PRODL | |
218 movf aa_width+1,W | |
219 subwfb PRODH,F | |
220 infsnz PRODL ; PROD+1 --> PROD | |
221 incf PRODH | |
222 AA_CMD_WRITE 0x35 ; this is the left border | |
223 AA_DATA_WRITE_PROD ; Output left | |
224 | |
225 PLED_box_noflip_H: | |
226 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
227 btfsc WREG,0 ; 180° rotation ? | |
228 bra PLED_box_flip_V | |
229 | |
230 ;---- Normal vertical window ----------------------------------------- | |
231 ; Output 0x37 (top) (bottom) | |
232 movff win_top,PRODH ; top --> PRODH (first byte) | |
233 movff win_height,WREG | |
234 addwf PRODH,W | |
235 decf WREG | |
236 movwf PRODL ; top+height-1 --> PRODL (second byte) | |
237 | |
238 AA_CMD_WRITE 0x37 | |
239 AA_DATA_WRITE_PROD | |
240 | |
241 movff PRODH,PRODL | |
242 clrf PRODH ; Start pixel V coord == top. | |
243 AA_CMD_WRITE 0x20 | |
244 AA_DATA_WRITE_PROD | |
245 | |
246 return | |
247 | |
248 ;---- Flipped vertical window ---------------------------------------- | |
249 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height | |
250 ; flipped(top) = 239-top | |
251 PLED_box_flip_V: | |
252 movff win_top,PRODL | |
253 movff win_height,WREG | |
254 addwf PRODL,W | |
255 sublw .240 ; 240 - top - height | |
256 movwf PRODH ; First byte | |
257 | |
258 movf PRODL,W | |
259 sublw .239 ; 249-top | |
260 movwf PRODL ; --> second byte. | |
261 | |
262 AA_CMD_WRITE 0x37 | |
263 AA_DATA_WRITE_PROD | |
264 | |
265 clrf PRODH ; Start pixel V coord. | |
266 AA_CMD_WRITE 0x20 | |
267 AA_DATA_WRITE_PROD | |
268 | |
269 return | |
270 | |
271 ;============================================================================= | |
123 | 272 ; PLED_frame : draw a frame around current box with current color. |
273 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
274 ; Outputs: (none) | |
275 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 | |
0 | 276 |
142 | 277 PLED_frame: |
278 movff win_top,aa_start+0 ; Backup everything. | |
123 | 279 movff win_height,aa_start+1 |
280 movff win_leftx2,aa_end+0 | |
281 movff win_width,aa_end+1 | |
0 | 282 |
123 | 283 ;---- TOP line ----------------------------------------------------------- |
142 | 284 movlw 1 ; row ~ height=1 |
123 | 285 movff WREG,win_height |
286 rcall PLED_box | |
0 | 287 |
123 | 288 ;---- BOTTOM line -------------------------------------------------------- |
142 | 289 movff aa_start+0,PRODL ; Get back top, |
290 movff aa_start+1,WREG ; and height | |
291 addwf PRODL,W ; top+height | |
292 decf WREG ; top+height-1 | |
293 movff WREG,win_top ; top+height-1 --> top | |
123 | 294 rcall PLED_box |
0 | 295 |
123 | 296 ;---- LEFT column -------------------------------------------------------- |
297 movff aa_start+0,win_top ; Restore top/height. | |
298 movff aa_start+1,win_height | |
299 movlw 1 ; column ~ width=1 | |
300 movff WREG,win_width | |
301 rcall PLED_box | |
0 | 302 |
123 | 303 ;---- RIGHT column ------------------------------------------------------- |
304 movff aa_end+0,WREG | |
305 movff aa_end+1,PRODL | |
306 addwf PRODL,W | |
307 decf WREG | |
308 movff WREG,win_leftx2 | |
309 bra PLED_box | |
0 | 310 |
123 | 311 ;============================================================================= |
312 ; PLED_box : fills current box with current color. | |
313 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
314 ; Outputs: (none) | |
315 ; Trashed: WREG, PROD | |
0 | 316 |
317 PLED_box: | |
123 | 318 ;---- Define Window ------------------------------------------------------ |
142 | 319 movff win_width,WREG |
320 bcf STATUS,C | |
321 rlcf WREG | |
322 movwf aa_width | |
323 movlw 0 | |
324 rlcf WREG | |
325 movwf aa_width+1 | |
326 rcall PLED_box_write | |
0 | 327 |
123 | 328 ;---- Fill Window -------------------------------------------------------- |
142 | 329 movlw 0x22 ; Start Writing Data to GRAM |
0 | 330 rcall PLED_CmdWrite |
331 | |
142 | 332 movff win_width,PRODH |
333 bsf oled_rs ; Data! | |
0 | 334 |
142 | 335 PLED_box2: ; Loop height times |
336 movff win_height,PRODL | |
337 PLED_box3: ; loop width times | |
0 | 338 movff win_color1,PORTD |
339 bcf oled_rw | |
142 | 340 bsf oled_rw ; Upper |
0 | 341 movff win_color2,PORTD |
342 bcf oled_rw | |
142 | 343 bsf oled_rw ; Lower |
0 | 344 |
345 movff win_color1,PORTD | |
346 bcf oled_rw | |
142 | 347 bsf oled_rw ; Upper |
0 | 348 movff win_color2,PORTD |
349 bcf oled_rw | |
142 | 350 bsf oled_rw ; Lower |
0 | 351 |
123 | 352 decfsz PRODL,F |
0 | 353 bra PLED_box3 |
123 | 354 decfsz PRODH,F |
0 | 355 bra PLED_box2 |
356 | |
142 | 357 movlw 0x00 ; NOP, to stop Address Update Counter |
358 bra PLED_CmdWrite ; returns... | |
0 | 359 |
123 | 360 ;============================================================================= |
129
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
123
diff
changeset
|
361 ; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black. |
123 | 362 ; Trashed: WREG, PROD |
0 | 363 |
364 PLED_ClearScreen: | |
365 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
366 rcall PLED_CmdWrite | |
123 | 367 mullw 0 |
368 rcall PLED_DataWrite_PROD | |
0 | 369 |
370 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
371 rcall PLED_CmdWrite | |
372 movlw 0x01 | |
123 | 373 rcall PLED_DataWrite |
0 | 374 movlw 0x3F |
123 | 375 rcall PLED_DataWrite |
0 | 376 |
377 movlw 0x37 ; HorizontalAddress START:END | |
378 rcall PLED_CmdWrite | |
379 movlw 0x00 | |
123 | 380 rcall PLED_DataWrite |
0 | 381 movlw 0xEF |
123 | 382 rcall PLED_DataWrite |
0 | 383 |
384 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
385 rcall PLED_CmdWrite | |
123 | 386 rcall PLED_DataWrite_PROD |
0 | 387 |
388 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
389 rcall PLED_CmdWrite | |
123 | 390 rcall PLED_DataWrite_PROD |
0 | 391 |
392 movlw 0x22 ; Start Writing Data to GRAM | |
393 rcall PLED_CmdWrite | |
394 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
395 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks |
0 | 396 bsf oled_rs ; Data! |
397 | |
123 | 398 movlw .160 |
399 movwf PRODH | |
0 | 400 PLED_ClearScreen2: |
123 | 401 movlw .240 |
402 movwf PRODL | |
0 | 403 PLED_ClearScreen3: |
404 | |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
405 clrf PORTD ; Need to generate trace here too. |
0 | 406 bcf oled_rw |
407 bsf oled_rw ; Upper | |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
408 |
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
409 clrf PORTD ; Need to generate trace here too. |
0 | 410 bcf oled_rw |
411 bsf oled_rw ; Lower | |
412 | |
123 | 413 clrf PORTD ; Need to generate trace here too. |
414 bcf oled_rw | |
415 bsf oled_rw ; Upper | |
416 | |
417 clrf PORTD ; Need to generate trace here too. | |
418 bcf oled_rw | |
419 bsf oled_rw ; Lower | |
420 | |
421 decfsz PRODL,F | |
0 | 422 bra PLED_ClearScreen3 |
123 | 423 decfsz PRODH,F |
0 | 424 bra PLED_ClearScreen2 |
425 | |
426 movlw 0x00 ; NOP, to stop Address Update Counter | |
123 | 427 bra PLED_CmdWrite |
0 | 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: | |
123 | 443 bsf oled_rs ; Data! |
444 movwf PORTD ; Move Data to PORTD | |
445 bcf oled_rw | |
446 bsf oled_rw | |
447 return | |
0 | 448 |
449 ; ----------------------------- | |
450 ; PLED Data Cmd via W | |
451 ; ----------------------------- | |
123 | 452 PLED_DataWrite_PROD: |
0 | 453 bsf oled_rs ; Data! |
123 | 454 movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian) |
455 bcf oled_rw | |
456 bsf oled_rw | |
457 movff PRODL,PORTD ; Move low byte to PORTD | |
0 | 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 | |
123 | 488 rcall PLED_DataWrite |
0 | 489 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL |
123 | 490 rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock |
0 | 491 |
492 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | |
493 rcall PLED_CmdWrite | |
142 | 494 movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color |
123 | 495 rcall PLED_DataWrite |
142 | 496 |
497 ; Change direction for block-writes of pixels | |
498 lfsr FSR0,win_flags | |
499 btfss INDF0,0 ; BANK-SAFE bit test. | |
500 movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM | |
501 btfsc INDF0,0 | |
502 movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM | |
123 | 503 rcall PLED_DataWrite |
0 | 504 |
505 movlw 0x18 | |
506 rcall PLED_CmdWrite | |
507 movlw 0x00 | |
123 | 508 rcall PLED_DataWrite |
0 | 509 movlw 0x28 |
123 | 510 rcall PLED_DataWrite |
0 | 511 |
512 movlw 0xF8 | |
513 rcall PLED_CmdWrite | |
514 movlw 0x00 | |
123 | 515 rcall PLED_DataWrite |
0 | 516 movlw 0x0F |
123 | 517 rcall PLED_DataWrite |
0 | 518 |
519 movlw 0xF9 | |
520 rcall PLED_CmdWrite | |
521 movlw 0x00 | |
123 | 522 rcall PLED_DataWrite |
0 | 523 movlw 0x0F |
123 | 524 rcall PLED_DataWrite |
0 | 525 |
526 movlw 0x10 | |
527 rcall PLED_CmdWrite | |
528 movlw 0x00 | |
123 | 529 rcall PLED_DataWrite |
0 | 530 movlw 0x00 |
123 | 531 rcall PLED_DataWrite |
0 | 532 |
533 ; Now Gamma settings... | |
534 rcall PLED_brightness_full | |
2 | 535 ;rcall PLED_brightness_low |
0 | 536 ; End Gamma Settings |
537 | |
538 rcall PLED_ClearScreen | |
539 | |
540 bsf oled_hv | |
541 WAITMS d'32' | |
542 | |
543 movlw 0x05 | |
544 rcall PLED_CmdWrite | |
545 movlw 0x00 | |
123 | 546 rcall PLED_DataWrite |
0 | 547 movlw 0x01 |
123 | 548 rcall PLED_DataWrite ; Display ON |
0 | 549 return |
550 | |
551 | |
552 PLED_brightness_full: | |
553 movlw 0x70 | |
554 rcall PLED_CmdWrite | |
555 movlw 0x1F | |
123 | 556 rcall PLED_DataWrite |
0 | 557 movlw 0x00 |
123 | 558 rcall PLED_DataWrite |
0 | 559 movlw 0x71 |
560 rcall PLED_CmdWrite | |
561 movlw 0x23 | |
123 | 562 rcall PLED_DataWrite |
0 | 563 movlw 0x80 |
123 | 564 rcall PLED_DataWrite |
0 | 565 movlw 0x72 |
566 rcall PLED_CmdWrite | |
567 movlw 0x2A | |
123 | 568 rcall PLED_DataWrite |
0 | 569 movlw 0x80 |
123 | 570 rcall PLED_DataWrite |
0 | 571 |
572 movlw 0x73 | |
573 rcall PLED_CmdWrite | |
574 movlw 0x15 | |
123 | 575 rcall PLED_DataWrite |
0 | 576 movlw 0x11 |
123 | 577 rcall PLED_DataWrite |
0 | 578 movlw 0x74 |
579 rcall PLED_CmdWrite | |
580 movlw 0x1C | |
123 | 581 rcall PLED_DataWrite |
0 | 582 movlw 0x11 |
123 | 583 rcall PLED_DataWrite |
0 | 584 |
585 movlw 0x75 | |
586 rcall PLED_CmdWrite | |
587 movlw 0x1B | |
123 | 588 rcall PLED_DataWrite |
0 | 589 movlw 0x15 |
123 | 590 rcall PLED_DataWrite |
0 | 591 movlw 0x76 |
592 rcall PLED_CmdWrite | |
593 movlw 0x1A | |
123 | 594 rcall PLED_DataWrite |
0 | 595 movlw 0x15 |
123 | 596 rcall PLED_DataWrite |
0 | 597 |
598 movlw 0x77 | |
599 rcall PLED_CmdWrite | |
600 movlw 0x1C | |
123 | 601 rcall PLED_DataWrite |
0 | 602 movlw 0x18 |
123 | 603 rcall PLED_DataWrite |
0 | 604 movlw 0x78 |
605 rcall PLED_CmdWrite | |
606 movlw 0x21 | |
123 | 607 rcall PLED_DataWrite |
0 | 608 movlw 0x15 |
123 | 609 rcall PLED_DataWrite |
0 | 610 |
611 return | |
612 | |
613 PLED_brightness_low: | |
614 movlw 0x70 | |
615 rcall PLED_CmdWrite | |
616 movlw 0x14 | |
123 | 617 rcall PLED_DataWrite |
0 | 618 movlw 0x00 |
123 | 619 rcall PLED_DataWrite |
0 | 620 movlw 0x71 |
621 rcall PLED_CmdWrite | |
622 movlw 0x17 | |
123 | 623 rcall PLED_DataWrite |
0 | 624 movlw 0x00 |
123 | 625 rcall PLED_DataWrite |
0 | 626 movlw 0x72 |
627 rcall PLED_CmdWrite | |
628 movlw 0x15 | |
123 | 629 rcall PLED_DataWrite |
0 | 630 movlw 0x80 |
123 | 631 rcall PLED_DataWrite |
0 | 632 |
633 movlw 0x73 | |
634 rcall PLED_CmdWrite | |
635 movlw 0x15 | |
123 | 636 rcall PLED_DataWrite |
0 | 637 movlw 0x11 |
123 | 638 rcall PLED_DataWrite |
0 | 639 movlw 0x74 |
640 rcall PLED_CmdWrite | |
641 movlw 0x14 | |
123 | 642 rcall PLED_DataWrite |
0 | 643 movlw 0x0B |
123 | 644 rcall PLED_DataWrite |
0 | 645 |
646 movlw 0x75 | |
647 rcall PLED_CmdWrite | |
648 movlw 0x1B | |
123 | 649 rcall PLED_DataWrite |
0 | 650 movlw 0x15 |
123 | 651 rcall PLED_DataWrite |
0 | 652 movlw 0x76 |
653 rcall PLED_CmdWrite | |
654 movlw 0x13 | |
123 | 655 rcall PLED_DataWrite |
0 | 656 movlw 0x0E |
123 | 657 rcall PLED_DataWrite |
0 | 658 |
659 movlw 0x77 | |
660 rcall PLED_CmdWrite | |
661 movlw 0x1C | |
123 | 662 rcall PLED_DataWrite |
0 | 663 movlw 0x18 |
123 | 664 rcall PLED_DataWrite |
0 | 665 movlw 0x78 |
666 rcall PLED_CmdWrite | |
667 movlw 0x15 | |
123 | 668 rcall PLED_DataWrite |
0 | 669 movlw 0x0E |
123 | 670 rcall PLED_DataWrite |
0 | 671 |
672 return | |
673 | |
674 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' | |
675 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' | |
676 movff oled1_temp, oled2_temp ; Copy | |
677 | |
678 ; Mask Bit 7,6,5,4,3,2 | |
679 movlw b'00000011' | |
680 andwf oled2_temp,F | |
681 | |
682 movlw b'00000000' | |
683 dcfsnz oled2_temp,F | |
684 movlw b'01010000' | |
685 dcfsnz oled2_temp,F | |
686 movlw b'10100000' | |
687 dcfsnz oled2_temp,F | |
688 movlw b'11111000' | |
689 movwf oled3_temp ; Blue done. | |
690 | |
691 movff oled1_temp, oled2_temp ; Copy | |
692 ; Mask Bit 7,6,5,1,0 | |
693 movlw b'00011100' | |
694 andwf oled2_temp,F | |
695 rrncf oled2_temp,F | |
696 rrncf oled2_temp,F | |
697 | |
698 movlw b'00000000' | |
699 dcfsnz oled2_temp,F | |
700 movlw b'00000100' | |
701 dcfsnz oled2_temp,F | |
702 movlw b'00001000' | |
703 dcfsnz oled2_temp,F | |
704 movlw b'00001100' | |
705 dcfsnz oled2_temp,F | |
706 movlw b'00010000' | |
707 dcfsnz oled2_temp,F | |
708 movlw b'00010100' | |
709 dcfsnz oled2_temp,F | |
710 movlw b'00100000' | |
711 dcfsnz oled2_temp,F | |
712 movlw b'00111111' | |
713 movwf oled4_temp | |
714 | |
715 rrcf oled4_temp,F | |
716 rrcf oled3_temp,F | |
717 | |
718 rrcf oled4_temp,F | |
719 rrcf oled3_temp,F | |
720 | |
721 rrcf oled4_temp,F | |
722 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done. | |
723 | |
724 movff oled1_temp, oled2_temp ; Copy | |
725 clrf oled1_temp | |
726 | |
727 rrcf oled4_temp,F | |
728 rrcf oled1_temp,F | |
729 | |
730 rrcf oled4_temp,F | |
731 rrcf oled1_temp,F | |
732 | |
733 rrcf oled4_temp,F | |
734 rrcf oled1_temp,F ; Green done. | |
735 | |
736 ; Mask Bit 4,3,2,1,0 | |
737 movlw b'11100000' | |
738 andwf oled2_temp,F | |
739 | |
740 rrncf oled2_temp,F | |
741 rrncf oled2_temp,F | |
742 rrncf oled2_temp,F | |
743 rrncf oled2_temp,F | |
744 rrncf oled2_temp,F | |
745 | |
746 movlw b'00000000' | |
747 dcfsnz oled2_temp,F | |
748 movlw b'00000100' | |
749 dcfsnz oled2_temp,F | |
750 movlw b'00001000' | |
751 dcfsnz oled2_temp,F | |
752 movlw b'00001100' | |
753 dcfsnz oled2_temp,F | |
754 movlw b'00010000' | |
755 dcfsnz oled2_temp,F | |
756 movlw b'00010100' | |
757 dcfsnz oled2_temp,F | |
758 movlw b'00100000' | |
759 dcfsnz oled2_temp,F | |
760 movlw b'00111111' | |
761 movwf oled4_temp | |
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 | |
771 | |
772 rrcf oled4_temp,F | |
773 rrcf oled1_temp,F | |
774 | |
775 rrcf oled4_temp,F | |
776 rrcf oled1_temp,F ; Red done. | |
777 | |
778 movff oled1_temp,win_color1 | |
779 movff oled3_temp,win_color2 ; Set Bank0 Color registers... | |
780 return | |
781 |