Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/oled_samsung.asm @ 239:3ed240d60341
High altitude (Plane/Fly) mode added
author | heinrichsweikamp |
---|---|
date | Mon, 21 Mar 2011 13:31:38 +0100 |
parents | cb055a7d75f3 |
children | 447390289f47 |
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 ;============================================================================= |
146 | 61 ; Macro to provides our own interface code. |
142 | 62 ; |
146 | 63 PIXEL_WRITE macro colRegister, rowRegister |
64 movff colRegister,win_leftx2 | |
65 movff rowRegister,win_top | |
66 call pixel_write | |
67 endm | |
123 | 68 |
146 | 69 INIT_PIXEL_WROTE macro colRegister |
70 movff colRegister,win_leftx2 | |
71 call init_pixel_write | |
72 endm | |
73 | |
74 HALF_PIXEL_WRITE macro rowRegister | |
75 movff rowRegister,win_top | |
76 call half_pixel_write | |
77 endm | |
0 | 78 |
146 | 79 ;----------------------------------------------------------------------------- |
80 ; Init for half_pixel_write | |
81 ; Set column register on OLED device, and current color. | |
82 ; Inputs: win_leftx2 | |
83 ; Outputs: win_color:2 | |
84 ; Trashed: WREG, PROD | |
85 init_pixel_write: | |
86 movff win_leftx2,WREG | |
87 mullw 2 | |
88 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) | |
89 goto PLED_standard_color | |
90 | |
91 ;----------------------------------------------------------------------------- | |
92 ; Writes two half-pixels at position (win_top,win_leftx2) | |
93 ; Inputs: win_leftx2, win_top, win_color:2 | |
94 ; Trashed: WREG, PROD | |
95 pixel_write: | |
96 movff win_leftx2,WREG | |
97 mullw 2 | |
98 rcall pixel_write_col320 ; Start Address Vertical (.0 - .319) | |
99 rcall half_pixel_write ; Write this half-one. | |
123 | 100 |
146 | 101 movff win_leftx2,WREG ; Address of next one |
102 mullw 2 | |
103 infsnz PRODL ; +1 | |
104 incf PRODH | |
105 rcall pixel_write_col320 | |
106 bra half_pixel_write ; Note: Cmd 0x20 is mandatory, because | |
107 ; of the autoincrement going vertical | |
108 | |
109 ;---- Do the 16bit 319-X-->X, if needed, and send to OLED ------------ | |
110 pixel_write_col320: | |
111 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
112 btfss WREG,0 ; 180° rotation ? | |
113 bra pixel_write_noflip_H | |
114 | |
115 movf PRODL,W ; 16bits 319 - PROD --> PROD | |
116 sublw LOW(.319) ; 319-W --> W | |
117 movwf PRODL | |
118 movf PRODH,W | |
119 btfss STATUS,C ; Borrow = /CARRY | |
120 incf WREG | |
121 sublw HIGH(.319) | |
122 movwf PRODH | |
0 | 123 |
146 | 124 pixel_write_noflip_H: |
125 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
126 rcall PLED_CmdWrite | |
127 bra PLED_DataWrite_PROD | |
128 | |
129 ;----------------------------------------------------------------------------- | |
130 ; Writes one half-pixel at position (win_top,win_leftx2). | |
131 ; Inputs: win_leftx2, win_top, win_color:2 | |
132 ; Trashed: WREG, PROD | |
133 half_pixel_write: | |
134 movff win_top,WREG ; d'0' ... d'239' | |
135 | |
136 movff win_flags,PRODL ; BEWARE: bank0 bit-test | |
137 btfsc PRODL,0 ; 180° rotation ? | |
138 sublw .239 ; 239-Y --> Y | |
0 | 139 |
146 | 140 mullw 1 ; Copy row to PRODH:L |
141 movlw 0x20 ; Horizontal Address START:END | |
142 rcall PLED_CmdWrite | |
143 rcall PLED_DataWrite_PROD | |
144 | |
145 movlw 0x22 ; Start Writing Data to GRAM | |
146 rcall PLED_CmdWrite | |
147 bsf oled_rs ; Data! | |
148 movff win_color1, PORTD | |
149 bcf oled_rw | |
150 bsf oled_rw ; Upper | |
151 movff win_color2, PORTD | |
152 bcf oled_rw | |
153 bsf oled_rw ; Lower | |
154 return | |
0 | 155 |
156 ; ----------------------------- | |
157 ; PLED Display Off | |
158 ; ----------------------------- | |
159 PLED_DisplayOff: | |
160 clrf PORTD | |
161 bcf oled_hv | |
162 bcf oled_vdd | |
163 bcf oled_cs | |
164 bcf oled_e_nwr | |
165 bcf oled_rw | |
166 bcf oled_nreset | |
167 return | |
168 | |
123 | 169 ;============================================================================= |
142 | 170 ; Fast macros to write to OLED display. |
171 ; Adding a call/return adds 3 words and a pipeline flush, hence make it | |
172 ; nearly twice slower... | |
173 ; | |
174 ; Input : commande as macro parameter. | |
175 ; Output : NONE | |
176 ; Trash : WREG | |
177 ; | |
178 AA_CMD_WRITE macro cmd | |
179 movlw cmd | |
180 rcall PLED_CmdWrite | |
181 ; bcf oled_rs ; Cmd mode | |
182 ; movwf PORTD,A | |
183 ; bcf oled_rw ; Tick the clock | |
184 ; bsf oled_rw | |
185 endm | |
186 ; | |
187 ; Input : PRODH:L as 16bits data. | |
188 ; Output : NONE | |
189 ; Trash : NONE | |
190 ; | |
191 AA_DATA_WRITE_PROD macro | |
192 rcall PLED_DataWrite_PROD | |
193 ; bsf oled_rs ; Data mode | |
194 ; movff PRODH,PORTD ; NOTE: OLED is BIGENDIAN! | |
195 ; bcf oled_rw ; Tick the clock | |
196 ; bsf oled_rw | |
197 ; movff PRODL,PORTD | |
198 ; bcf oled_rw ; Tick the clock | |
199 ; bsf oled_rw | |
200 endm | |
201 | |
202 ;============================================================================= | |
203 ; Output OLED Window Address commands. | |
204 ; Inputs : win_top, win_leftx2, win_height, aa_width. | |
205 ; Output : PortD commands. | |
206 ; Trashed: PROD | |
207 ; | |
208 PLED_box_write: | |
209 movff win_leftx2,WREG ; Compute left = 2*leftx2 --> PROD | |
210 mullw 2 | |
211 | |
212 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
213 btfsc WREG,0 ; 180° rotation ? | |
214 bra PLED_box_flip_H ; YES: | |
215 | |
216 ;---- Normal horizontal window --------------------------------------- | |
217 ; Output 0x35 left, | |
218 ; 0x36 right == left + width - 1. | |
219 AA_CMD_WRITE 0x35 ; this is the left border | |
220 AA_DATA_WRITE_PROD ; Output left | |
221 AA_CMD_WRITE 0x21 ; Also the horizontal first pix coord. | |
222 AA_DATA_WRITE_PROD | |
223 | |
224 movf aa_width+0,W,ACCESS ; right = left + width - 1 | |
225 addwf PRODL,F | |
226 movf aa_width+1,W,ACCESS | |
227 addwfc PRODH,F | |
228 decf PRODL,F,A ; decrement result | |
229 btfss STATUS,C | |
230 decf PRODH,F,A | |
231 | |
232 AA_CMD_WRITE 0x36 ; Write and the right border | |
233 AA_DATA_WRITE_PROD | |
234 | |
235 bra PLED_box_noflip_H | |
236 | |
237 ;---- Flipped horizontal window -------------------------------------- | |
238 PLED_box_flip_H: | |
239 ; Output 0x36 flipped(left) = 319-left | |
240 ; 0x35 flipped(right) = 319-right = 320 - left - width | |
241 movf PRODL,W ; 16bits 319 - PROD --> PROD | |
242 sublw LOW(.319) ; 319-W --> W | |
243 movwf PRODL | |
244 movf PRODH,W | |
245 btfss STATUS,C ; Borrow = /CARRY | |
246 incf WREG | |
247 sublw HIGH(.319) | |
248 movwf PRODH | |
249 AA_CMD_WRITE 0x36 ; this is the left border | |
250 AA_DATA_WRITE_PROD ; Output left | |
251 AA_CMD_WRITE 0x21 | |
252 AA_DATA_WRITE_PROD | |
253 | |
254 movf aa_width+0,W ; 16bits PROD - width --> PROD | |
255 subwf PRODL,F ; PRODL - WREG --> PRODL | |
256 movf aa_width+1,W | |
257 subwfb PRODH,F | |
258 infsnz PRODL ; PROD+1 --> PROD | |
259 incf PRODH | |
260 AA_CMD_WRITE 0x35 ; this is the left border | |
261 AA_DATA_WRITE_PROD ; Output left | |
262 | |
263 PLED_box_noflip_H: | |
264 movff win_flags,WREG ; BEWARE: bank0 bit-test | |
265 btfsc WREG,0 ; 180° rotation ? | |
266 bra PLED_box_flip_V | |
267 | |
268 ;---- Normal vertical window ----------------------------------------- | |
269 ; Output 0x37 (top) (bottom) | |
270 movff win_top,PRODH ; top --> PRODH (first byte) | |
271 movff win_height,WREG | |
272 addwf PRODH,W | |
273 decf WREG | |
274 movwf PRODL ; top+height-1 --> PRODL (second byte) | |
275 | |
276 AA_CMD_WRITE 0x37 | |
277 AA_DATA_WRITE_PROD | |
278 | |
279 movff PRODH,PRODL | |
280 clrf PRODH ; Start pixel V coord == top. | |
281 AA_CMD_WRITE 0x20 | |
282 AA_DATA_WRITE_PROD | |
283 | |
284 return | |
285 | |
286 ;---- Flipped vertical window ---------------------------------------- | |
287 ; Output 0x37 flipped(bottom) = 239-bottom = 240 - top - height | |
288 ; flipped(top) = 239-top | |
289 PLED_box_flip_V: | |
290 movff win_top,PRODL | |
291 movff win_height,WREG | |
292 addwf PRODL,W | |
293 sublw .240 ; 240 - top - height | |
294 movwf PRODH ; First byte | |
295 | |
296 movf PRODL,W | |
297 sublw .239 ; 249-top | |
298 movwf PRODL ; --> second byte. | |
299 | |
300 AA_CMD_WRITE 0x37 | |
301 AA_DATA_WRITE_PROD | |
302 | |
303 clrf PRODH ; Start pixel V coord. | |
304 AA_CMD_WRITE 0x20 | |
305 AA_DATA_WRITE_PROD | |
306 | |
307 return | |
308 | |
309 ;============================================================================= | |
123 | 310 ; PLED_frame : draw a frame around current box with current color. |
311 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
312 ; Outputs: (none) | |
313 ; Trashed: WREG, PROD, aa_start:2, aa_end:2, win_leftx2, win_width:1 | |
167 | 314 global PLED_frame |
142 | 315 PLED_frame: |
316 movff win_top,aa_start+0 ; Backup everything. | |
123 | 317 movff win_height,aa_start+1 |
318 movff win_leftx2,aa_end+0 | |
319 movff win_width,aa_end+1 | |
0 | 320 |
123 | 321 ;---- TOP line ----------------------------------------------------------- |
142 | 322 movlw 1 ; row ~ height=1 |
123 | 323 movff WREG,win_height |
324 rcall PLED_box | |
0 | 325 |
123 | 326 ;---- BOTTOM line -------------------------------------------------------- |
142 | 327 movff aa_start+0,PRODL ; Get back top, |
328 movff aa_start+1,WREG ; and height | |
329 addwf PRODL,W ; top+height | |
330 decf WREG ; top+height-1 | |
331 movff WREG,win_top ; top+height-1 --> top | |
123 | 332 rcall PLED_box |
0 | 333 |
123 | 334 ;---- LEFT column -------------------------------------------------------- |
335 movff aa_start+0,win_top ; Restore top/height. | |
336 movff aa_start+1,win_height | |
337 movlw 1 ; column ~ width=1 | |
338 movff WREG,win_width | |
339 rcall PLED_box | |
0 | 340 |
123 | 341 ;---- RIGHT column ------------------------------------------------------- |
342 movff aa_end+0,WREG | |
343 movff aa_end+1,PRODL | |
344 addwf PRODL,W | |
345 decf WREG | |
346 movff WREG,win_leftx2 | |
347 bra PLED_box | |
0 | 348 |
123 | 349 ;============================================================================= |
350 ; PLED_box : fills current box with current color. | |
351 ; Inputs: win_top, win_leftx2, win_height, win_width, win_color1, win_color2 | |
352 ; Outputs: (none) | |
353 ; Trashed: WREG, PROD | |
0 | 354 |
167 | 355 global PLED_box |
0 | 356 PLED_box: |
123 | 357 ;---- Define Window ------------------------------------------------------ |
142 | 358 movff win_width,WREG |
359 bcf STATUS,C | |
360 rlcf WREG | |
150 | 361 movwf aa_width+0 |
142 | 362 movlw 0 |
363 rlcf WREG | |
364 movwf aa_width+1 | |
365 rcall PLED_box_write | |
0 | 366 |
123 | 367 ;---- Fill Window -------------------------------------------------------- |
150 | 368 movlw 0x22 ; Start Writing Data to GRAM |
0 | 369 rcall PLED_CmdWrite |
370 | |
150 | 371 clrf PRODH ; Column counter. |
372 bsf oled_rs ; Data! | |
0 | 373 |
150 | 374 PLED_box2: ; Loop height times |
142 | 375 movff win_height,PRODL |
150 | 376 |
377 PLED_box3: ; loop width times | |
0 | 378 movff win_color1,PORTD |
379 bcf oled_rw | |
150 | 380 bsf oled_rw ; Upper |
0 | 381 movff win_color2,PORTD |
382 bcf oled_rw | |
150 | 383 bsf oled_rw ; Lower |
0 | 384 |
385 movff win_color1,PORTD | |
386 bcf oled_rw | |
150 | 387 bsf oled_rw ; Upper |
0 | 388 movff win_color2,PORTD |
389 bcf oled_rw | |
150 | 390 bsf oled_rw ; Lower |
391 | |
392 decfsz PRODL,F ; row loop finished ? | |
393 bra PLED_box3 ; No: continue. | |
394 | |
395 incf PRODH,F ; column count ++ | |
396 | |
397 movff win_bargraph,WREG ; current column == bargraph ? | |
398 cpfseq PRODH | |
399 bra PLED_box4 ; No: just loop. | |
0 | 400 |
150 | 401 clrf WREG ; Yes: switch to black |
402 movff WREG,win_color1 | |
403 movff WREG,win_color2 | |
404 PLED_box4: | |
405 movff win_width,WREG | |
406 cpfseq PRODH | |
407 bra PLED_box2 | |
0 | 408 |
150 | 409 movlw 0x00 ; NOP, to stop window mode |
410 rcall PLED_CmdWrite | |
411 | |
412 setf WREG ; Reset bargraph mode... | |
413 movff WREG,win_bargraph | |
414 return | |
0 | 415 |
123 | 416 ;============================================================================= |
129
06c4899ddb4b
Custom views in dive mode configrable (New CF50-CF53)
Heinrichsweikamp
parents:
123
diff
changeset
|
417 ; PLED_ClearScreen: An optimized version of PLEX_box, for full screen black. |
123 | 418 ; Trashed: WREG, PROD |
0 | 419 |
167 | 420 global PLED_ClearScreen |
0 | 421 PLED_ClearScreen: |
422 movlw 0x35 ; VerticalStartAddress HIGH:LOW | |
423 rcall PLED_CmdWrite | |
123 | 424 mullw 0 |
425 rcall PLED_DataWrite_PROD | |
0 | 426 |
427 movlw 0x36 ; VerticalEndAddress HIGH:LOW | |
428 rcall PLED_CmdWrite | |
429 movlw 0x01 | |
123 | 430 rcall PLED_DataWrite |
0 | 431 movlw 0x3F |
123 | 432 rcall PLED_DataWrite |
0 | 433 |
434 movlw 0x37 ; HorizontalAddress START:END | |
435 rcall PLED_CmdWrite | |
436 movlw 0x00 | |
123 | 437 rcall PLED_DataWrite |
0 | 438 movlw 0xEF |
123 | 439 rcall PLED_DataWrite |
0 | 440 |
441 movlw 0x20 ; Start Address Horizontal (.0 - .239) | |
442 rcall PLED_CmdWrite | |
123 | 443 rcall PLED_DataWrite_PROD |
0 | 444 |
445 movlw 0x21 ; Start Address Vertical (.0 - .319) | |
446 rcall PLED_CmdWrite | |
123 | 447 rcall PLED_DataWrite_PROD |
0 | 448 |
150 | 449 movlw 0x22 ; Start Writing Data to GRAM |
0 | 450 rcall PLED_CmdWrite |
451 | |
83
3e351e25f5d1
adding anti-aliased fonts frame and merging some patches from Jeando
heinrichsweikamp
parents:
81
diff
changeset
|
452 ; See Page 101 of OLED Driver IC Datasheet how to handle rs/rw clocks |
150 | 453 bsf oled_rs ; Data! |
0 | 454 |
123 | 455 movlw .160 |
456 movwf PRODH | |
0 | 457 PLED_ClearScreen2: |
123 | 458 movlw .240 |
459 movwf PRODL | |
0 | 460 PLED_ClearScreen3: |
461 | |
150 | 462 clrf PORTD ; Need to generate trace here too. |
0 | 463 bcf oled_rw |
150 | 464 bsf oled_rw ; Upper |
81
31fa973a70fd
Kludges to emulate inexisting devices when debugged with the MPLAB software SIMulator.
JeanDo
parents:
3
diff
changeset
|
465 |
150 | 466 clrf PORTD ; Need to generate trace here too. |
0 | 467 bcf oled_rw |
150 | 468 bsf oled_rw ; Lower |
0 | 469 |
150 | 470 clrf PORTD ; Need to generate trace here too. |
123 | 471 bcf oled_rw |
150 | 472 bsf oled_rw ; Upper |
123 | 473 |
150 | 474 clrf PORTD ; Need to generate trace here too. |
123 | 475 bcf oled_rw |
150 | 476 bsf oled_rw ; Lower |
123 | 477 |
478 decfsz PRODL,F | |
0 | 479 bra PLED_ClearScreen3 |
123 | 480 decfsz PRODH,F |
0 | 481 bra PLED_ClearScreen2 |
482 | |
483 movlw 0x00 ; NOP, to stop Address Update Counter | |
123 | 484 bra PLED_CmdWrite |
0 | 485 |
486 ; ----------------------------- | |
487 ; PLED Write Cmd via W | |
488 ; ----------------------------- | |
489 PLED_CmdWrite: | |
490 bcf oled_rs ; Command! | |
491 movwf PORTD ; Move Data to PORTD | |
492 bcf oled_rw | |
493 bsf oled_rw | |
494 return | |
495 | |
496 ; ----------------------------- | |
497 ; PLED Write Display Data via W | |
498 ; ----------------------------- | |
499 PLED_DataWrite: | |
123 | 500 bsf oled_rs ; Data! |
501 movwf PORTD ; Move Data to PORTD | |
502 bcf oled_rw | |
503 bsf oled_rw | |
504 return | |
0 | 505 |
506 ; ----------------------------- | |
507 ; PLED Data Cmd via W | |
508 ; ----------------------------- | |
123 | 509 PLED_DataWrite_PROD: |
0 | 510 bsf oled_rs ; Data! |
123 | 511 movff PRODH,PORTD ; Move high byte to PORTD (OLED is bigendian) |
512 bcf oled_rw | |
513 bsf oled_rw | |
514 movff PRODL,PORTD ; Move low byte to PORTD | |
0 | 515 bcf oled_rw |
516 bsf oled_rw | |
517 return | |
518 | |
519 ; ----------------------------- | |
520 ; PLED boot | |
521 ; ----------------------------- | |
522 PLED_boot: | |
523 bcf oled_hv | |
524 WAITMS d'32' | |
525 bsf oled_vdd | |
526 nop | |
527 bcf oled_cs | |
528 nop | |
529 bsf oled_nreset | |
3 | 530 ; WAITMS d'10' ; Quick wake-up |
531 WAITMS d'250' ; Standard wake-up | |
0 | 532 bsf oled_e_nwr |
533 nop | |
534 bcf oled_nreset | |
535 WAIT10US d'2' | |
536 bsf oled_nreset | |
537 WAITMS d'10' | |
538 | |
539 movlw 0x24 ; 80-System 8-Bit Mode | |
540 rcall PLED_CmdWrite | |
541 | |
542 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42) | |
543 rcall PLED_CmdWrite | |
544 movlw 0x00 ; X X X X X X X RM | |
123 | 545 rcall PLED_DataWrite |
0 | 546 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL |
123 | 547 rcall PLED_DataWrite ; System Interface: RIM is ignored, Internal Clock |
0 | 548 |
549 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46) | |
550 rcall PLED_CmdWrite | |
142 | 551 movlw 0x00 ; CLS MDT1 MDT0 BGR X X X SS 65k Color |
123 | 552 rcall PLED_DataWrite |
142 | 553 |
554 ; Change direction for block-writes of pixels | |
555 lfsr FSR0,win_flags | |
556 btfss INDF0,0 ; BANK-SAFE bit test. | |
557 movlw b'00110000' ; [normal] X X I/D1 I/D0 X X X AM | |
558 btfsc INDF0,0 | |
559 movlw b'00000000' ; [flipped] X X I/D1 I/D0 X X X AM | |
123 | 560 rcall PLED_DataWrite |
0 | 561 |
562 movlw 0x18 | |
563 rcall PLED_CmdWrite | |
564 movlw 0x00 | |
123 | 565 rcall PLED_DataWrite |
0 | 566 movlw 0x28 |
123 | 567 rcall PLED_DataWrite |
0 | 568 |
569 movlw 0xF8 | |
570 rcall PLED_CmdWrite | |
571 movlw 0x00 | |
123 | 572 rcall PLED_DataWrite |
0 | 573 movlw 0x0F |
123 | 574 rcall PLED_DataWrite |
0 | 575 |
576 movlw 0xF9 | |
577 rcall PLED_CmdWrite | |
578 movlw 0x00 | |
123 | 579 rcall PLED_DataWrite |
0 | 580 movlw 0x0F |
123 | 581 rcall PLED_DataWrite |
0 | 582 |
583 movlw 0x10 | |
584 rcall PLED_CmdWrite | |
585 movlw 0x00 | |
123 | 586 rcall PLED_DataWrite |
0 | 587 movlw 0x00 |
123 | 588 rcall PLED_DataWrite |
0 | 589 |
590 ; Now Gamma settings... | |
591 rcall PLED_brightness_full | |
2 | 592 ;rcall PLED_brightness_low |
0 | 593 ; End Gamma Settings |
594 | |
595 rcall PLED_ClearScreen | |
596 | |
597 bsf oled_hv | |
598 WAITMS d'32' | |
599 | |
600 movlw 0x05 | |
601 rcall PLED_CmdWrite | |
602 movlw 0x00 | |
123 | 603 rcall PLED_DataWrite |
0 | 604 movlw 0x01 |
123 | 605 rcall PLED_DataWrite ; Display ON |
0 | 606 return |
607 | |
608 | |
609 PLED_brightness_full: | |
610 movlw 0x70 | |
611 rcall PLED_CmdWrite | |
612 movlw 0x1F | |
123 | 613 rcall PLED_DataWrite |
0 | 614 movlw 0x00 |
123 | 615 rcall PLED_DataWrite |
0 | 616 movlw 0x71 |
617 rcall PLED_CmdWrite | |
618 movlw 0x23 | |
123 | 619 rcall PLED_DataWrite |
0 | 620 movlw 0x80 |
123 | 621 rcall PLED_DataWrite |
0 | 622 movlw 0x72 |
623 rcall PLED_CmdWrite | |
624 movlw 0x2A | |
123 | 625 rcall PLED_DataWrite |
0 | 626 movlw 0x80 |
123 | 627 rcall PLED_DataWrite |
0 | 628 |
629 movlw 0x73 | |
630 rcall PLED_CmdWrite | |
631 movlw 0x15 | |
123 | 632 rcall PLED_DataWrite |
0 | 633 movlw 0x11 |
123 | 634 rcall PLED_DataWrite |
0 | 635 movlw 0x74 |
636 rcall PLED_CmdWrite | |
637 movlw 0x1C | |
123 | 638 rcall PLED_DataWrite |
0 | 639 movlw 0x11 |
123 | 640 rcall PLED_DataWrite |
0 | 641 |
642 movlw 0x75 | |
643 rcall PLED_CmdWrite | |
644 movlw 0x1B | |
123 | 645 rcall PLED_DataWrite |
0 | 646 movlw 0x15 |
123 | 647 rcall PLED_DataWrite |
0 | 648 movlw 0x76 |
649 rcall PLED_CmdWrite | |
650 movlw 0x1A | |
123 | 651 rcall PLED_DataWrite |
0 | 652 movlw 0x15 |
123 | 653 rcall PLED_DataWrite |
0 | 654 |
655 movlw 0x77 | |
656 rcall PLED_CmdWrite | |
657 movlw 0x1C | |
123 | 658 rcall PLED_DataWrite |
0 | 659 movlw 0x18 |
123 | 660 rcall PLED_DataWrite |
0 | 661 movlw 0x78 |
662 rcall PLED_CmdWrite | |
663 movlw 0x21 | |
123 | 664 rcall PLED_DataWrite |
0 | 665 movlw 0x15 |
123 | 666 rcall PLED_DataWrite |
0 | 667 |
668 return | |
669 | |
670 PLED_brightness_low: | |
671 movlw 0x70 | |
672 rcall PLED_CmdWrite | |
673 movlw 0x14 | |
123 | 674 rcall PLED_DataWrite |
0 | 675 movlw 0x00 |
123 | 676 rcall PLED_DataWrite |
0 | 677 movlw 0x71 |
678 rcall PLED_CmdWrite | |
679 movlw 0x17 | |
123 | 680 rcall PLED_DataWrite |
0 | 681 movlw 0x00 |
123 | 682 rcall PLED_DataWrite |
0 | 683 movlw 0x72 |
684 rcall PLED_CmdWrite | |
685 movlw 0x15 | |
123 | 686 rcall PLED_DataWrite |
0 | 687 movlw 0x80 |
123 | 688 rcall PLED_DataWrite |
0 | 689 |
690 movlw 0x73 | |
691 rcall PLED_CmdWrite | |
692 movlw 0x15 | |
123 | 693 rcall PLED_DataWrite |
0 | 694 movlw 0x11 |
123 | 695 rcall PLED_DataWrite |
0 | 696 movlw 0x74 |
697 rcall PLED_CmdWrite | |
698 movlw 0x14 | |
123 | 699 rcall PLED_DataWrite |
0 | 700 movlw 0x0B |
123 | 701 rcall PLED_DataWrite |
0 | 702 |
703 movlw 0x75 | |
704 rcall PLED_CmdWrite | |
705 movlw 0x1B | |
123 | 706 rcall PLED_DataWrite |
0 | 707 movlw 0x15 |
123 | 708 rcall PLED_DataWrite |
0 | 709 movlw 0x76 |
710 rcall PLED_CmdWrite | |
711 movlw 0x13 | |
123 | 712 rcall PLED_DataWrite |
0 | 713 movlw 0x0E |
123 | 714 rcall PLED_DataWrite |
0 | 715 |
716 movlw 0x77 | |
717 rcall PLED_CmdWrite | |
718 movlw 0x1C | |
123 | 719 rcall PLED_DataWrite |
0 | 720 movlw 0x18 |
123 | 721 rcall PLED_DataWrite |
0 | 722 movlw 0x78 |
723 rcall PLED_CmdWrite | |
724 movlw 0x15 | |
123 | 725 rcall PLED_DataWrite |
0 | 726 movlw 0x0E |
123 | 727 rcall PLED_DataWrite |
0 | 728 |
729 return | |
730 | |
731 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB' | |
732 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB' | |
733 movff oled1_temp, oled2_temp ; Copy | |
734 | |
735 ; Mask Bit 7,6,5,4,3,2 | |
736 movlw b'00000011' | |
737 andwf oled2_temp,F | |
738 | |
739 movlw b'00000000' | |
740 dcfsnz oled2_temp,F | |
741 movlw b'01010000' | |
742 dcfsnz oled2_temp,F | |
743 movlw b'10100000' | |
744 dcfsnz oled2_temp,F | |
745 movlw b'11111000' | |
746 movwf oled3_temp ; Blue done. | |
747 | |
748 movff oled1_temp, oled2_temp ; Copy | |
749 ; Mask Bit 7,6,5,1,0 | |
750 movlw b'00011100' | |
751 andwf oled2_temp,F | |
752 rrncf oled2_temp,F | |
753 rrncf oled2_temp,F | |
754 | |
755 movlw b'00000000' | |
756 dcfsnz oled2_temp,F | |
757 movlw b'00000100' | |
758 dcfsnz oled2_temp,F | |
759 movlw b'00001000' | |
760 dcfsnz oled2_temp,F | |
761 movlw b'00001100' | |
762 dcfsnz oled2_temp,F | |
763 movlw b'00010000' | |
764 dcfsnz oled2_temp,F | |
765 movlw b'00010100' | |
766 dcfsnz oled2_temp,F | |
767 movlw b'00100000' | |
768 dcfsnz oled2_temp,F | |
769 movlw b'00111111' | |
770 movwf oled4_temp | |
771 | |
772 rrcf oled4_temp,F | |
773 rrcf oled3_temp,F | |
774 | |
775 rrcf oled4_temp,F | |
776 rrcf oled3_temp,F | |
777 | |
778 rrcf oled4_temp,F | |
779 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done. | |
780 | |
781 movff oled1_temp, oled2_temp ; Copy | |
782 clrf oled1_temp | |
783 | |
784 rrcf oled4_temp,F | |
785 rrcf oled1_temp,F | |
786 | |
787 rrcf oled4_temp,F | |
788 rrcf oled1_temp,F | |
789 | |
790 rrcf oled4_temp,F | |
791 rrcf oled1_temp,F ; Green done. | |
792 | |
793 ; Mask Bit 4,3,2,1,0 | |
794 movlw b'11100000' | |
795 andwf oled2_temp,F | |
796 | |
797 rrncf oled2_temp,F | |
798 rrncf oled2_temp,F | |
799 rrncf oled2_temp,F | |
800 rrncf oled2_temp,F | |
801 rrncf oled2_temp,F | |
802 | |
803 movlw b'00000000' | |
804 dcfsnz oled2_temp,F | |
805 movlw b'00000100' | |
806 dcfsnz oled2_temp,F | |
807 movlw b'00001000' | |
808 dcfsnz oled2_temp,F | |
809 movlw b'00001100' | |
810 dcfsnz oled2_temp,F | |
811 movlw b'00010000' | |
812 dcfsnz oled2_temp,F | |
813 movlw b'00010100' | |
814 dcfsnz oled2_temp,F | |
815 movlw b'00100000' | |
816 dcfsnz oled2_temp,F | |
817 movlw b'00111111' | |
818 movwf oled4_temp | |
819 | |
820 rrcf oled4_temp,F | |
821 rrcf oled1_temp,F | |
822 | |
823 rrcf oled4_temp,F | |
824 rrcf oled1_temp,F | |
825 | |
826 rrcf oled4_temp,F | |
827 rrcf oled1_temp,F | |
828 | |
829 rrcf oled4_temp,F | |
830 rrcf oled1_temp,F | |
831 | |
832 rrcf oled4_temp,F | |
833 rrcf oled1_temp,F ; Red done. | |
834 | |
835 movff oled1_temp,win_color1 | |
836 movff oled3_temp,win_color2 ; Set Bank0 Color registers... | |
837 return | |
838 |