fl hex { 240X68dots Graphic LCD WD-G2406B-1YLYa 2013/03/05 14:33:23 PropForth5.2/5.0 Using graphic-LCD(WD-G2406B-1YLYa) Propeller WD-G2406B-1YLYa 1 FG P0 ---------- 2 DIO1(FLM) P1 ---------- 3 LP P2 ---------- 4 SCP P3 ---------- 5 FR(M) P4 ---------- 6 DI 7 Vdd 8 -Vee 9 Vss 10 Vadj P5 ---------- -9V_on } lockdict create WD_G2406B forthentry $C_a_lxasm w, h148 h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z2WyPW1 l, zfiPZB l, z2WibJC l, zfyPW1 l, z2WibRC l, zfyPW1 l, z2WibZC l, zfyPW1 l, z2WibeC l, z2WiPZB l, z20yPW4 l, z2Wybj1 l, zfibmC l, z2WyPWV l, zfiPZB l, z1bixmC l, z1SyLI[ l, z2WyPW2 l, z2WibuB l, z2WyPc0 l, z2WyPjU l, ziQ57 l, zfyQ0O l, z20ybr1 l, z2WyPr8 l, zgyQ01 l, z1jix\6 l, z1bix\4 l, z1SybCx l, z1[ix\4 l, z1SybCx l, z3[yPvf l, z3[yPnb l, z1bix\3 l, z26VPc0 l, z1rix\2 l, z1SybCx l, z1[ix\3 l, z3[yPfa l, z26VPW2 l, z1rix\5 l, z3[yP[\ l, z1SV04[ l, z2WiQFk l, z20yQ8l l, z3ryQ80 l, z1SV000 l, 0 l, 0 l, 0 l, 0 l, 0 l, 0 l, freedict \ Character Font 8X8dots wvariable Font -2 allot h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ (space) h30 c, h78 c, h78 c, h30 c, h30 c, h00 c, h30 c, h00 c, \ ! h6C c, h6C c, h28 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ " " h6C c, h6C c, hFE c, h6C c, hFE c, h6C c, h6C c, h00 c, \ # h18 c, h7E c, hC0 c, h7C c, h06 c, hFC c, h18 c, h00 c, \ $ h00 c, hC6 c, hCC c, h18 c, h30 c, h66 c, hC6 c, h00 c, \ % h38 c, h6C c, h38 c, h76 c, hDC c, hCC c, h76 c, h00 c, \ & h30 c, h30 c, h60 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ \ h18 c, h30 c, h60 c, h60 c, h60 c, h30 c, h18 c, h00 c, \ ( h60 c, h30 c, h18 c, h18 c, h18 c, h30 c, h60 c, h00 c, \ ) h00 c, h66 c, h3C c, hFF c, h3C c, h66 c, h00 c, h00 c, \ * h00 c, h30 c, h30 c, hFC c, h30 c, h30 c, h00 c, h00 c, \ + h00 c, h00 c, h00 c, h00 c, h00 c, h30 c, h30 c, h60 c, \ , h00 c, h00 c, h00 c, hFC c, h00 c, h00 c, h00 c, h00 c, \ - h00 c, h00 c, h00 c, h00 c, h00 c, h30 c, h30 c, h00 c, \ . h06 c, h0C c, h18 c, h30 c, h60 c, hC0 c, h80 c, h00 c, \ / h7C c, hC6 c, hC6 c, hD6 c, hC6 c, hC6 c, h7C c, h00 c, \ 0 h30 c, h70 c, h30 c, h30 c, h30 c, h30 c, hFC c, h00 c, \ 1 h78 c, hCC c, h0C c, h38 c, h60 c, hCC c, hFC c, h00 c, \ 2 h78 c, hCC c, h0C c, h38 c, h0C c, hCC c, h78 c, h00 c, \ 3 h1C c, h3C c, h6C c, hCC c, hFE c, h0C c, h1E c, h00 c, \ 4 hFC c, hC0 c, hF8 c, h0C c, h0C c, hCC c, h78 c, h00 c, \ 5 h38 c, h60 c, hC0 c, hF8 c, hCC c, hCC c, h78 c, h00 c, \ 6 hFC c, hCC c, h0C c, h18 c, h30 c, h30 c, h30 c, h00 c, \ 7 h78 c, hCC c, hCC c, h78 c, hCC c, hCC c, h78 c, h00 c, \ 8 h78 c, hCC c, hCC c, h7C c, h0C c, h18 c, h70 c, h00 c, \ 9 h00 c, h30 c, h30 c, h00 c, h00 c, h30 c, h30 c, h00 c, \ : h00 c, h30 c, h30 c, h00 c, h00 c, h30 c, h30 c, h60 c, \ ; h18 c, h30 c, h60 c, hC0 c, h60 c, h30 c, h18 c, h00 c, \ < h00 c, h00 c, hFC c, h00 c, h00 c, hFC c, h00 c, h00 c, \ = h60 c, h30 c, h18 c, h0C c, h18 c, h30 c, h60 c, h00 c, \ > h78 c, hCC c, h0C c, h18 c, h30 c, h00 c, h30 c, h00 c, \ ? h7C c, hC6 c, hDE c, hDE c, hDC c, hC0 c, h78 c, h00 c, \ @ h30 c, h78 c, hCC c, hCC c, hFC c, hCC c, hCC c, h00 c, \ A hFC c, h66 c, h66 c, h7C c, h66 c, h66 c, hFC c, h00 c, \ B h3C c, h66 c, hC0 c, hC0 c, hC0 c, h66 c, h3C c, h00 c, \ C hF8 c, h6C c, h66 c, h66 c, h66 c, h6C c, hF8 c, h00 c, \ D hFE c, h62 c, h68 c, h78 c, h68 c, h62 c, hFE c, h00 c, \ E hFE c, h62 c, h68 c, h78 c, h68 c, h60 c, hF0 c, h00 c, \ F h3C c, h66 c, hC0 c, hC0 c, hCE c, h66 c, h3E c, h00 c, \ G hCC c, hCC c, hCC c, hFC c, hCC c, hCC c, hCC c, h00 c, \ H h78 c, h30 c, h30 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ I h1E c, h0C c, h0C c, h0C c, hCC c, hCC c, h78 c, h00 c, \ J hE6 c, h66 c, h6C c, h78 c, h6C c, h66 c, hE6 c, h00 c, \ K hF0 c, h60 c, h60 c, h60 c, h62 c, h66 c, hFE c, h00 c, \ L hC6 c, hEE c, hFE c, hFE c, hD6 c, hC6 c, hC6 c, h00 c, \ M hC6 c, hE6 c, hF6 c, hDE c, hCE c, hC6 c, hC6 c, h00 c, \ N h38 c, h6C c, hC6 c, hC6 c, hC6 c, h6C c, h38 c, h00 c, \ O hFC c, h66 c, h66 c, h7C c, h60 c, h60 c, hF0 c, h00 c, \ P h78 c, hCC c, hCC c, hCC c, hDC c, h78 c, h1C c, h00 c, \ Q hFC c, h66 c, h66 c, h7C c, h6C c, h66 c, hE6 c, h00 c, \ R h78 c, hCC c, hC0 c, h78 c, h0C c, hCC c, h78 c, h00 c, \ S hFC c, hB4 c, h30 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ T hCC c, hCC c, hCC c, hCC c, hCC c, hCC c, hFC c, h00 c, \ U hCC c, hCC c, hCC c, hCC c, hCC c, h78 c, h30 c, h00 c, \ V hC6 c, hC6 c, hC6 c, hD6 c, hFE c, hEE c, hC6 c, h00 c, \ W hC6 c, h6C c, h38 c, h38 c, h6C c, hC6 c, hC6 c, h00 c, \ X hCC c, hCC c, hCC c, h78 c, h30 c, h30 c, h78 c, h00 c, \ Y hFE c, hC6 c, h8C c, h18 c, h32 c, h66 c, hFE c, h00 c, \ Z h78 c, h60 c, h60 c, h60 c, h60 c, h60 c, h78 c, h00 c, \ [ hC0 c, h60 c, h30 c, h18 c, h0C c, h06 c, h02 c, h00 c, \ \ h78 c, h18 c, h18 c, h18 c, h18 c, h18 c, h78 c, h00 c, \ ] h10 c, h38 c, h6C c, hC6 c, h00 c, h00 c, h00 c, h00 c, \ ^ h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, hFF c, \ _ h30 c, h18 c, h0C c, h00 c, h00 c, h00 c, h00 c, h00 c, \ ` h00 c, h00 c, h78 c, h0C c, h7C c, hCC c, h76 c, h00 c, \ a hE0 c, h60 c, h60 c, h7C c, h66 c, h66 c, hDC c, h00 c, \ b h00 c, h00 c, h78 c, hCC c, hC0 c, hCC c, h78 c, h00 c, \ c h1C c, h0C c, h0C c, h7C c, hCC c, hCC c, h76 c, h00 c, \ d h00 c, h00 c, h78 c, hCC c, hFC c, hC0 c, h78 c, h00 c, \ e h38 c, h6C c, h60 c, hF0 c, h60 c, h60 c, hF0 c, h00 c, \ f h00 c, h00 c, h76 c, hCC c, hCC c, h7C c, h0C c, hF8 c, \ g hE0 c, h60 c, h6C c, h76 c, h66 c, h66 c, hE6 c, h00 c, \ h h30 c, h00 c, h70 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ i h0C c, h00 c, h0C c, h0C c, h0C c, hCC c, hCC c, h78 c, \ j hE0 c, h60 c, h66 c, h6C c, h78 c, h6C c, hE6 c, h00 c, \ k h70 c, h30 c, h30 c, h30 c, h30 c, h30 c, h78 c, h00 c, \ l h00 c, h00 c, hCC c, hFE c, hD6 c, hD6 c, hC6 c, h00 c, \ m h00 c, h00 c, hF8 c, hCC c, hCC c, hCC c, hCC c, h00 c, \ n h00 c, h00 c, h78 c, hCC c, hCC c, hCC c, h78 c, h00 c, \ o h00 c, h00 c, hDC c, h66 c, h66 c, h7C c, h60 c, hF0 c, \ p h00 c, h00 c, h76 c, hCC c, hCC c, h7C c, h0C c, h1E c, \ q h00 c, h00 c, hDC c, h76 c, h66 c, h60 c, hF0 c, h00 c, \ r h00 c, h00 c, h7C c, hC0 c, h78 c, h0C c, hF8 c, h00 c, \ s h10 c, h30 c, h7C c, h30 c, h30 c, h34 c, h18 c, h00 c, \ t h00 c, h00 c, hCC c, hCC c, hCC c, hCC c, h76 c, h00 c, \ u h00 c, h00 c, hCC c, hCC c, hCC c, h78 c, h30 c, h00 c, \ v h00 c, h00 c, hC6 c, hD6 c, hD6 c, hFE c, h6C c, h00 c, \ w h00 c, h00 c, hC6 c, h6C c, h38 c, h6C c, hC6 c, h00 c, \ x h00 c, h00 c, hCC c, hCC c, hCC c, h7C c, h0C c, hF8 c, \ y h00 c, h00 c, hFC c, h98 c, h30 c, h64 c, hFC c, h00 c, \ z h1C c, h30 c, h30 c, hE0 c, h30 c, h30 c, h1C c, h00 c, \ { h30 c, h30 c, h30 c, h30 c, h30 c, h30 c, h30 c, h00 c, \ | hE0 c, h30 c, h30 c, h1C c, h30 c, h30 c, hE0 c, h00 c, \ } h76 c, hDC c, h00 c, h00 c, h00 c, h00 c, h00 c, h00 c, \ ~ h38 c, h6C c, hC6 c, hC6 c, h6C c, h28 c, hEE c, h00 c, \ ohm wvariable vidMem d1918 allot \ 30bytes X 64bytes \ charcter position vidX=0-d29 vidY=0-7 wvariable vidX wvariable vidY \ basepin for WD-G2406B's control 0 wconstant BASE \ Clear vidMem \ ( n1 n2 -- ) n1:start address n2:number of word (2byte) : clear_vram 0 do dup 0 swap W! 2+ loop drop ; \ Display 8X8 Font : demo1 BASE 5 + pinout \ Disable -9V c" vidMem BASE WD_G2406B" 0 cogx \ Drive graphicLCD vidMem d960 clear_vram BASE 5 + pinhi \ Enable -9V \ vidX= 0 to d29 vidY= 0 to 7 0 vidX W! 0 vidY W! Font \ top address for character begin d96 0 do ." number= " i . cr dup i 3 lshift + \ Get Font-address vidMem vidX W@ + vidY W@ d240 u* + \ Calculate address of vidMem swap st? \ Copy character to vidMem 8 0 do 2dup C@ dup . swap i d30 u* + dup . C! 1+ \ Font-address + 1 cr loop 2drop vidX W@ 1+ dup d30 = \ Check if vixX = 30 if drop 0 vidX W! vidY W@ 1+ dup 8 = \ Check if vixY = 8 if drop 0 vidY W! else vidY W! then else vidX W! then loop ." AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" st? fkey? swap drop until drop \ LCD-off BASE 5 + pinlo \ Disable -9V 0 cogreset ; \ Display ROM-Font(16X32dots) wvariable odd wvariable 1_row : demo2 BASE 5 + pinout \ Disable -9V c" vidMem BASE WD_G2406B" 0 cogx \ Drive graphicLCD vidMem d960 clear_vram BASE 5 + pinhi \ Enable -9V \ vidX= 0 to 15 vidY= 0 to 1 0 vidX W! 0 vidY W! 0 1_row W! h8000 \ ROM Font address begin dup hC000 = if drop h8000 then \ ROM-Font Address cr cr dup ." $" hex . cr dup 3 1 do i odd W! d32 0 do dup L@ odd W@ d16 0 do \ Get 1-row (16bits) 2dup and if 1_row W@ 1 lshift 1 else 1_row W@ 1 lshift 0 then or 1_row W! \ ---- Display ROM-Font to terminal 2dup and if h2A else bl then emit \ ------------------------------------ 2 lshift loop 2drop cr vidMem vidX W@ 2 u* + \ X for vidMem vidY W@ d960 u* + d30 i u* \ Y for vidMem + \ Calculate address of vidMem 1_row W@ dup 8 lshift swap hFF00 and 8 rshift or swap W! \ Save 16bit-data to vidMem 4 + \ Add 4 to Font-addres loop vidX W@ 1+ dup d15 = \ Check if vixX = 15 if drop 0 vidX W! vidY W@ 1+ dup 2 = \ Check if vixY = 2 if drop 0 vidY W! else vidY W! then else vidX W! then d128 - d100 delms cr cr loop drop d128 + \ next character fkey? swap drop until drop \ LCD-off BASE 5 + pinlo \ Disable -9V 0 cogreset ; decimal { Driver for WD-G2406B-1YLYa ( n1 n2 -- ) n1:Address of vidMem n2:basepin fl build_BootOpt :rasm mov $C_treg1 , # 1 shl $C_treg1 , $C_stTOS \ Get FLM mov __flm , $C_treg1 shl $C_treg1 , # 1 \ Get LP mov __lp , $C_treg1 shl $C_treg1 , # 1 \ Get CP mov __cp , $C_treg1 shl $C_treg1 , # 1 \ Get M mov __m , $C_treg1 \ Get top of data mov $C_treg1 , $C_stTOS add $C_treg1 , # 4 mov __data , # 1 shl __data , $C_treg1 mov $C_treg1 , # h1F shl $C_treg1 , $C_stTOS \ Set pins to output or dira , $C_treg1 spop __1 mov $C_treg1 , # 2 __2 \ Get vidMem mov __vid , $C_stTOS mov $C_treg2 , # d64 __3 mov $C_treg3 , # d30 __4 \ Read vidmem rdbyte $C_treg5 , __vid shl $C_treg5 , # d24 add __vid , # 1 mov $C_treg4 , # 8 __5 \ Shift one pixel to lcd shl $C_treg5 , # 1 wc muxc outa , __data \ Set CP to High or outa , __cp jmpret __delay_ret , # __delay \ Set CP to Low andn outa , __cp jmpret __delay_ret , # __delay djnz $C_treg4 , # __5 djnz $C_treg3 , # __4 \ Set LP or outa , __lp \ Set FLM cmp $C_treg2 , # d64 wz muxz outa , __flm \ wait jmpret __delay_ret , # __delay andn outa , __lp djnz $C_treg2 , # __3 cmp $C_treg1 , # 2 wz \ Set M muxz outa , __m djnz $C_treg1 , # __2 jmp # __1 __delay mov $C_treg6 , cnt add $C_treg6 , # d50 waitcnt $C_treg6 , # 0 __delay_ret ret __flm 0 __lp 0 __cp 0 __m 0 __data 0 __vid 0 ;asm WD_G2406B }