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
|
|
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
|
2
|
523 ;rcall PLED_brightness_low
|
0
|
524 ; End Gamma Settings
|
|
525
|
|
526 rcall PLED_ClearScreen
|
|
527
|
|
528 bsf oled_hv
|
|
529 WAITMS d'32'
|
|
530
|
|
531 movlw 0x05
|
|
532 rcall PLED_CmdWrite
|
|
533 movlw 0x00
|
|
534 rcall PLED_DatWrite
|
|
535 movlw 0x01
|
|
536 rcall PLED_DatWrite ; Display ON
|
|
537 return
|
|
538
|
|
539
|
|
540 PLED_brightness_full:
|
|
541 movlw 0x70
|
|
542 rcall PLED_CmdWrite
|
|
543 movlw 0x1F
|
|
544 rcall PLED_DatWrite
|
|
545 movlw 0x00
|
|
546 rcall PLED_DatWrite
|
|
547 movlw 0x71
|
|
548 rcall PLED_CmdWrite
|
|
549 movlw 0x23
|
|
550 rcall PLED_DatWrite
|
|
551 movlw 0x80
|
|
552 rcall PLED_DatWrite
|
|
553 movlw 0x72
|
|
554 rcall PLED_CmdWrite
|
|
555 movlw 0x2A
|
|
556 rcall PLED_DatWrite
|
|
557 movlw 0x80
|
|
558 rcall PLED_DatWrite
|
|
559
|
|
560 movlw 0x73
|
|
561 rcall PLED_CmdWrite
|
|
562 movlw 0x15
|
|
563 rcall PLED_DatWrite
|
|
564 movlw 0x11
|
|
565 rcall PLED_DatWrite
|
|
566 movlw 0x74
|
|
567 rcall PLED_CmdWrite
|
|
568 movlw 0x1C
|
|
569 rcall PLED_DatWrite
|
|
570 movlw 0x11
|
|
571 rcall PLED_DatWrite
|
|
572
|
|
573 movlw 0x75
|
|
574 rcall PLED_CmdWrite
|
|
575 movlw 0x1B
|
|
576 rcall PLED_DatWrite
|
|
577 movlw 0x15
|
|
578 rcall PLED_DatWrite
|
|
579 movlw 0x76
|
|
580 rcall PLED_CmdWrite
|
|
581 movlw 0x1A
|
|
582 rcall PLED_DatWrite
|
|
583 movlw 0x15
|
|
584 rcall PLED_DatWrite
|
|
585
|
|
586 movlw 0x77
|
|
587 rcall PLED_CmdWrite
|
|
588 movlw 0x1C
|
|
589 rcall PLED_DatWrite
|
|
590 movlw 0x18
|
|
591 rcall PLED_DatWrite
|
|
592 movlw 0x78
|
|
593 rcall PLED_CmdWrite
|
|
594 movlw 0x21
|
|
595 rcall PLED_DatWrite
|
|
596 movlw 0x15
|
|
597 rcall PLED_DatWrite
|
|
598
|
|
599 return
|
|
600
|
|
601 PLED_brightness_low:
|
|
602 movlw 0x70
|
|
603 rcall PLED_CmdWrite
|
|
604 movlw 0x14
|
|
605 rcall PLED_DatWrite
|
|
606 movlw 0x00
|
|
607 rcall PLED_DatWrite
|
|
608 movlw 0x71
|
|
609 rcall PLED_CmdWrite
|
|
610 movlw 0x17
|
|
611 rcall PLED_DatWrite
|
|
612 movlw 0x00
|
|
613 rcall PLED_DatWrite
|
|
614 movlw 0x72
|
|
615 rcall PLED_CmdWrite
|
|
616 movlw 0x15
|
|
617 rcall PLED_DatWrite
|
|
618 movlw 0x80
|
|
619 rcall PLED_DatWrite
|
|
620
|
|
621 movlw 0x73
|
|
622 rcall PLED_CmdWrite
|
|
623 movlw 0x15
|
|
624 rcall PLED_DatWrite
|
|
625 movlw 0x11
|
|
626 rcall PLED_DatWrite
|
|
627 movlw 0x74
|
|
628 rcall PLED_CmdWrite
|
|
629 movlw 0x14
|
|
630 rcall PLED_DatWrite
|
|
631 movlw 0x0B
|
|
632 rcall PLED_DatWrite
|
|
633
|
|
634 movlw 0x75
|
|
635 rcall PLED_CmdWrite
|
|
636 movlw 0x1B
|
|
637 rcall PLED_DatWrite
|
|
638 movlw 0x15
|
|
639 rcall PLED_DatWrite
|
|
640 movlw 0x76
|
|
641 rcall PLED_CmdWrite
|
|
642 movlw 0x13
|
|
643 rcall PLED_DatWrite
|
|
644 movlw 0x0E
|
|
645 rcall PLED_DatWrite
|
|
646
|
|
647 movlw 0x77
|
|
648 rcall PLED_CmdWrite
|
|
649 movlw 0x1C
|
|
650 rcall PLED_DatWrite
|
|
651 movlw 0x18
|
|
652 rcall PLED_DatWrite
|
|
653 movlw 0x78
|
|
654 rcall PLED_CmdWrite
|
|
655 movlw 0x15
|
|
656 rcall PLED_DatWrite
|
|
657 movlw 0x0E
|
|
658 rcall PLED_DatWrite
|
|
659
|
|
660 return
|
|
661
|
|
662 PLED_set_color:;Converts 8Bit RGB b'RRRGGGBB' into 16Bit RGB b'RRRRRGGGGGGBBBBB'
|
|
663 movwf oled1_temp ; Get 8Bit RGB b'RRRGGGBB'
|
|
664 movff oled1_temp, oled2_temp ; Copy
|
|
665
|
|
666 ; Mask Bit 7,6,5,4,3,2
|
|
667 movlw b'00000011'
|
|
668 andwf oled2_temp,F
|
|
669
|
|
670 movlw b'00000000'
|
|
671 dcfsnz oled2_temp,F
|
|
672 movlw b'01010000'
|
|
673 dcfsnz oled2_temp,F
|
|
674 movlw b'10100000'
|
|
675 dcfsnz oled2_temp,F
|
|
676 movlw b'11111000'
|
|
677 movwf oled3_temp ; Blue done.
|
|
678
|
|
679 movff oled1_temp, oled2_temp ; Copy
|
|
680 ; Mask Bit 7,6,5,1,0
|
|
681 movlw b'00011100'
|
|
682 andwf oled2_temp,F
|
|
683 rrncf oled2_temp,F
|
|
684 rrncf oled2_temp,F
|
|
685
|
|
686 movlw b'00000000'
|
|
687 dcfsnz oled2_temp,F
|
|
688 movlw b'00000100'
|
|
689 dcfsnz oled2_temp,F
|
|
690 movlw b'00001000'
|
|
691 dcfsnz oled2_temp,F
|
|
692 movlw b'00001100'
|
|
693 dcfsnz oled2_temp,F
|
|
694 movlw b'00010000'
|
|
695 dcfsnz oled2_temp,F
|
|
696 movlw b'00010100'
|
|
697 dcfsnz oled2_temp,F
|
|
698 movlw b'00100000'
|
|
699 dcfsnz oled2_temp,F
|
|
700 movlw b'00111111'
|
|
701 movwf oled4_temp
|
|
702
|
|
703 rrcf oled4_temp,F
|
|
704 rrcf oled3_temp,F
|
|
705
|
|
706 rrcf oled4_temp,F
|
|
707 rrcf oled3_temp,F
|
|
708
|
|
709 rrcf oled4_temp,F
|
|
710 rrcf oled3_temp,F ; oled3_temp (b'GGGBBBBB') done.
|
|
711
|
|
712 movff oled1_temp, oled2_temp ; Copy
|
|
713 clrf oled1_temp
|
|
714
|
|
715 rrcf oled4_temp,F
|
|
716 rrcf oled1_temp,F
|
|
717
|
|
718 rrcf oled4_temp,F
|
|
719 rrcf oled1_temp,F
|
|
720
|
|
721 rrcf oled4_temp,F
|
|
722 rrcf oled1_temp,F ; Green done.
|
|
723
|
|
724 ; Mask Bit 4,3,2,1,0
|
|
725 movlw b'11100000'
|
|
726 andwf oled2_temp,F
|
|
727
|
|
728 rrncf oled2_temp,F
|
|
729 rrncf oled2_temp,F
|
|
730 rrncf oled2_temp,F
|
|
731 rrncf oled2_temp,F
|
|
732 rrncf oled2_temp,F
|
|
733
|
|
734 movlw b'00000000'
|
|
735 dcfsnz oled2_temp,F
|
|
736 movlw b'00000100'
|
|
737 dcfsnz oled2_temp,F
|
|
738 movlw b'00001000'
|
|
739 dcfsnz oled2_temp,F
|
|
740 movlw b'00001100'
|
|
741 dcfsnz oled2_temp,F
|
|
742 movlw b'00010000'
|
|
743 dcfsnz oled2_temp,F
|
|
744 movlw b'00010100'
|
|
745 dcfsnz oled2_temp,F
|
|
746 movlw b'00100000'
|
|
747 dcfsnz oled2_temp,F
|
|
748 movlw b'00111111'
|
|
749 movwf oled4_temp
|
|
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
|
|
762
|
|
763 rrcf oled4_temp,F
|
|
764 rrcf oled1_temp,F ; Red done.
|
|
765
|
|
766 movff oled1_temp,win_color1
|
|
767 movff oled3_temp,win_color2 ; Set Bank0 Color registers...
|
|
768 return
|
|
769
|