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 clrf PORTD ; See Page 101 of OLED Driver IC Datasheet
|
|
400
|
|
401 movlw d'10'
|
|
402 movwf draw_box_temp3
|
|
403 PLED_ClearScreen2:
|
|
404 movlw d'30'
|
|
405 movwf draw_box_temp2
|
|
406 PLED_ClearScreen3:
|
|
407 clrf draw_box_temp1 ; 30*10*256=76800 Pixels -> Clear complete 240*320
|
|
408 PLED_ClearScreen4:
|
|
409
|
|
410 bcf oled_rw
|
|
411 bsf oled_rw ; Upper
|
|
412 bcf oled_rw
|
|
413 bsf oled_rw ; Lower
|
|
414
|
|
415 decfsz draw_box_temp1,F
|
|
416 bra PLED_ClearScreen4
|
|
417 decfsz draw_box_temp2,F
|
|
418 bra PLED_ClearScreen3
|
|
419 decfsz draw_box_temp3,F
|
|
420 bra PLED_ClearScreen2
|
|
421
|
|
422 movlw 0x00 ; NOP, to stop Address Update Counter
|
|
423 rcall PLED_CmdWrite
|
|
424
|
|
425 return
|
|
426
|
|
427
|
|
428 ; -----------------------------
|
|
429 ; PLED Write Cmd via W
|
|
430 ; -----------------------------
|
|
431 PLED_CmdWrite:
|
|
432 bcf oled_rs ; Command!
|
|
433 movwf PORTD ; Move Data to PORTD
|
|
434 bcf oled_rw
|
|
435 bsf oled_rw
|
|
436 return
|
|
437
|
|
438 ; -----------------------------
|
|
439 ; PLED Write Display Data via W
|
|
440 ; -----------------------------
|
|
441 PLED_DataWrite:
|
|
442
|
|
443 ; -----------------------------
|
|
444 ; PLED Data Cmd via W
|
|
445 ; -----------------------------
|
|
446 PLED_DatWrite:
|
|
447 bsf oled_rs ; Data!
|
|
448 movwf PORTD ; Move Data to PORTD
|
|
449 bcf oled_rw
|
|
450 bsf oled_rw
|
|
451 return
|
|
452
|
|
453 ; -----------------------------
|
|
454 ; PLED boot
|
|
455 ; -----------------------------
|
|
456 PLED_boot:
|
|
457 bcf oled_hv
|
|
458 WAITMS d'32'
|
|
459 bsf oled_vdd
|
|
460 nop
|
|
461 bcf oled_cs
|
|
462 nop
|
|
463 bsf oled_nreset
|
3
|
464 ; WAITMS d'10' ; Quick wake-up
|
|
465 WAITMS d'250' ; Standard wake-up
|
0
|
466 bsf oled_e_nwr
|
|
467 nop
|
|
468 bcf oled_nreset
|
|
469 WAIT10US d'2'
|
|
470 bsf oled_nreset
|
|
471 WAITMS d'10'
|
|
472
|
|
473 movlw 0x24 ; 80-System 8-Bit Mode
|
|
474 rcall PLED_CmdWrite
|
|
475
|
|
476 movlw 0x02 ; RGB Interface Control (S6E63D6 Datasheet page 42)
|
|
477 rcall PLED_CmdWrite
|
|
478 movlw 0x00 ; X X X X X X X RM
|
|
479 rcall PLED_DatWrite
|
|
480 movlw 0x00 ; DM X RIM1 RIM0 VSPL HSPL EPL DPL
|
|
481 rcall PLED_DatWrite ; System Interface: RIM is ignored, Internal Clock
|
|
482
|
|
483 movlw 0x03 ; Entry Mode (S6E63D6 Datasheet page 46)
|
|
484 rcall PLED_CmdWrite
|
|
485 movlw 0x00 ; =b'00000000' CLS MDT1 MDT0 BGR X X X SS 65k Color
|
|
486 rcall PLED_DatWrite
|
|
487 movlw b'00110000' ; =b'00110000' X X I/D1 I/D0 X X X AM
|
|
488 rcall PLED_DatWrite
|
|
489
|
|
490 movlw 0x18
|
|
491 rcall PLED_CmdWrite
|
|
492 movlw 0x00
|
|
493 rcall PLED_DatWrite
|
|
494 movlw 0x28
|
|
495 rcall PLED_DatWrite
|
|
496
|
|
497 movlw 0xF8
|
|
498 rcall PLED_CmdWrite
|
|
499 movlw 0x00
|
|
500 rcall PLED_DatWrite
|
|
501 movlw 0x0F
|
|
502 rcall PLED_DatWrite
|
|
503
|
|
504 movlw 0xF9
|
|
505 rcall PLED_CmdWrite
|
|
506 movlw 0x00
|
|
507 rcall PLED_DatWrite
|
|
508 movlw 0x0F
|
|
509 rcall PLED_DatWrite
|
|
510
|
|
511 movlw 0x10
|
|
512 rcall PLED_CmdWrite
|
|
513 movlw 0x00
|
|
514 rcall PLED_DatWrite
|
|
515 movlw 0x00
|
|
516 rcall PLED_DatWrite
|
|
517
|
|
518 ; Now Gamma settings...
|
|
519 rcall PLED_brightness_full
|
2
|
520 ;rcall PLED_brightness_low
|
0
|
521 ; End Gamma Settings
|
|
522
|
|
523 rcall PLED_ClearScreen
|
|
524
|
|
525 bsf oled_hv
|
|
526 WAITMS d'32'
|
|
527
|
|
528 movlw 0x05
|
|
529 rcall PLED_CmdWrite
|
|
530 movlw 0x00
|
|
531 rcall PLED_DatWrite
|
|
532 movlw 0x01
|
|
533 rcall PLED_DatWrite ; Display ON
|
|
534 return
|
|
535
|
|
536
|
|
537 PLED_brightness_full:
|
|
538 movlw 0x70
|
|
539 rcall PLED_CmdWrite
|
|
540 movlw 0x1F
|
|
541 rcall PLED_DatWrite
|
|
542 movlw 0x00
|
|
543 rcall PLED_DatWrite
|
|
544 movlw 0x71
|
|
545 rcall PLED_CmdWrite
|
|
546 movlw 0x23
|
|
547 rcall PLED_DatWrite
|
|
548 movlw 0x80
|
|
549 rcall PLED_DatWrite
|
|
550 movlw 0x72
|
|
551 rcall PLED_CmdWrite
|
|
552 movlw 0x2A
|
|
553 rcall PLED_DatWrite
|
|
554 movlw 0x80
|
|
555 rcall PLED_DatWrite
|
|
556
|
|
557 movlw 0x73
|
|
558 rcall PLED_CmdWrite
|
|
559 movlw 0x15
|
|
560 rcall PLED_DatWrite
|
|
561 movlw 0x11
|
|
562 rcall PLED_DatWrite
|
|
563 movlw 0x74
|
|
564 rcall PLED_CmdWrite
|
|
565 movlw 0x1C
|
|
566 rcall PLED_DatWrite
|
|
567 movlw 0x11
|
|
568 rcall PLED_DatWrite
|
|
569
|
|
570 movlw 0x75
|
|
571 rcall PLED_CmdWrite
|
|
572 movlw 0x1B
|
|
573 rcall PLED_DatWrite
|
|
574 movlw 0x15
|
|
575 rcall PLED_DatWrite
|
|
576 movlw 0x76
|
|
577 rcall PLED_CmdWrite
|
|
578 movlw 0x1A
|
|
579 rcall PLED_DatWrite
|
|
580 movlw 0x15
|
|
581 rcall PLED_DatWrite
|
|
582
|
|
583 movlw 0x77
|
|
584 rcall PLED_CmdWrite
|
|
585 movlw 0x1C
|
|
586 rcall PLED_DatWrite
|
|
587 movlw 0x18
|
|
588 rcall PLED_DatWrite
|
|
589 movlw 0x78
|
|
590 rcall PLED_CmdWrite
|
|
591 movlw 0x21
|
|
592 rcall PLED_DatWrite
|
|
593 movlw 0x15
|
|
594 rcall PLED_DatWrite
|
|
595
|
|
596 return
|
|
597
|
|
598 PLED_brightness_low:
|
|
599 movlw 0x70
|
|
600 rcall PLED_CmdWrite
|
|
601 movlw 0x14
|
|
602 rcall PLED_DatWrite
|
|
603 movlw 0x00
|
|
604 rcall PLED_DatWrite
|
|
605 movlw 0x71
|
|
606 rcall PLED_CmdWrite
|
|
607 movlw 0x17
|
|
608 rcall PLED_DatWrite
|
|
609 movlw 0x00
|
|
610 rcall PLED_DatWrite
|
|
611 movlw 0x72
|
|
612 rcall PLED_CmdWrite
|
|
613 movlw 0x15
|
|
614 rcall PLED_DatWrite
|
|
615 movlw 0x80
|
|
616 rcall PLED_DatWrite
|
|
617
|
|
618 movlw 0x73
|
|
619 rcall PLED_CmdWrite
|
|
620 movlw 0x15
|
|
621 rcall PLED_DatWrite
|
|
622 movlw 0x11
|
|
623 rcall PLED_DatWrite
|
|
624 movlw 0x74
|
|
625 rcall PLED_CmdWrite
|
|
626 movlw 0x14
|
|
627 rcall PLED_DatWrite
|
|
628 movlw 0x0B
|
|
629 rcall PLED_DatWrite
|
|
630
|
|
631 movlw 0x75
|
|
632 rcall PLED_CmdWrite
|
|
633 movlw 0x1B
|
|
634 rcall PLED_DatWrite
|
|
635 movlw 0x15
|
|
636 rcall PLED_DatWrite
|
|
637 movlw 0x76
|
|
638 rcall PLED_CmdWrite
|
|
639 movlw 0x13
|
|
640 rcall PLED_DatWrite
|
|
641 movlw 0x0E
|
|
642 rcall PLED_DatWrite
|
|
643
|
|
644 movlw 0x77
|
|
645 rcall PLED_CmdWrite
|
|
646 movlw 0x1C
|
|
647 rcall PLED_DatWrite
|
|
648 movlw 0x18
|
|
649 rcall PLED_DatWrite
|
|
650 movlw 0x78
|
|
651 rcall PLED_CmdWrite
|
|
652 movlw 0x15
|
|
653 rcall PLED_DatWrite
|
|
654 movlw 0x0E
|
|
655 rcall PLED_DatWrite
|
|
656
|
|
657 return
|
|
658
|
|
659 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB'
|
|
660 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB'
|
|
661 movff oled1_temp, oled2_temp ; Copy
|
|
662
|
|
663 ; Mask Bit 7,6,5,4,3,2
|
|
664 movlw b'00000011'
|
|
665 andwf oled2_temp,F
|
|
666
|
|
667 movlw b'00000000'
|
|
668 dcfsnz oled2_temp,F
|
|
669 movlw b'01010000'
|
|
670 dcfsnz oled2_temp,F
|
|
671 movlw b'10100000'
|
|
672 dcfsnz oled2_temp,F
|
|
673 movlw b'11111000'
|
|
674 movwf oled3_temp ; Blue done.
|
|
675
|
|
676 movff oled1_temp, oled2_temp ; Copy
|
|
677 ; Mask Bit 7,6,5,1,0
|
|
678 movlw b'00011100'
|
|
679 andwf oled2_temp,F
|
|
680 rrncf oled2_temp,F
|
|
681 rrncf oled2_temp,F
|
|
682
|
|
683 movlw b'00000000'
|
|
684 dcfsnz oled2_temp,F
|
|
685 movlw b'00000100'
|
|
686 dcfsnz oled2_temp,F
|
|
687 movlw b'00001000'
|
|
688 dcfsnz oled2_temp,F
|
|
689 movlw b'00001100'
|
|
690 dcfsnz oled2_temp,F
|
|
691 movlw b'00010000'
|
|
692 dcfsnz oled2_temp,F
|
|
693 movlw b'00010100'
|
|
694 dcfsnz oled2_temp,F
|
|
695 movlw b'00100000'
|
|
696 dcfsnz oled2_temp,F
|
|
697 movlw b'00111111'
|
|
698 movwf oled4_temp
|
|
699
|
|
700 rrcf oled4_temp,F
|
|
701 rrcf oled3_temp,F
|
|
702
|
|
703 rrcf oled4_temp,F
|
|
704 rrcf oled3_temp,F
|
|
705
|
|
706 rrcf oled4_temp,F
|
|
707 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done.
|
|
708
|
|
709 movff oled1_temp, oled2_temp ; Copy
|
|
710 clrf oled1_temp
|
|
711
|
|
712 rrcf oled4_temp,F
|
|
713 rrcf oled1_temp,F
|
|
714
|
|
715 rrcf oled4_temp,F
|
|
716 rrcf oled1_temp,F
|
|
717
|
|
718 rrcf oled4_temp,F
|
|
719 rrcf oled1_temp,F ; Green done.
|
|
720
|
|
721 ; Mask Bit 4,3,2,1,0
|
|
722 movlw b'11100000'
|
|
723 andwf oled2_temp,F
|
|
724
|
|
725 rrncf oled2_temp,F
|
|
726 rrncf oled2_temp,F
|
|
727 rrncf oled2_temp,F
|
|
728 rrncf oled2_temp,F
|
|
729 rrncf oled2_temp,F
|
|
730
|
|
731 movlw b'00000000'
|
|
732 dcfsnz oled2_temp,F
|
|
733 movlw b'00000100'
|
|
734 dcfsnz oled2_temp,F
|
|
735 movlw b'00001000'
|
|
736 dcfsnz oled2_temp,F
|
|
737 movlw b'00001100'
|
|
738 dcfsnz oled2_temp,F
|
|
739 movlw b'00010000'
|
|
740 dcfsnz oled2_temp,F
|
|
741 movlw b'00010100'
|
|
742 dcfsnz oled2_temp,F
|
|
743 movlw b'00100000'
|
|
744 dcfsnz oled2_temp,F
|
|
745 movlw b'00111111'
|
|
746 movwf oled4_temp
|
|
747
|
|
748 rrcf oled4_temp,F
|
|
749 rrcf oled1_temp,F
|
|
750
|
|
751 rrcf oled4_temp,F
|
|
752 rrcf oled1_temp,F
|
|
753
|
|
754 rrcf oled4_temp,F
|
|
755 rrcf oled1_temp,F
|
|
756
|
|
757 rrcf oled4_temp,F
|
|
758 rrcf oled1_temp,F
|
|
759
|
|
760 rrcf oled4_temp,F
|
|
761 rrcf oled1_temp,F ; Red done.
|
|
762
|
|
763 movff oled1_temp,win_color1
|
|
764 movff oled3_temp,win_color2 ; Set Bank0 Color registers...
|
|
765 return
|
|
766
|