fl { PropForth 5.5 Gradation1 P0-P7 --- CharliePlexing 8x8DotMatrix P8 ------ buzzar P9 ------ SW 3.3V ---- 3.3V GND ----- GND 2015/01/20 16:35:36 } \ =========================================================================== \ Constants \ =========================================================================== variable pic1 -4 allot d16 c, d16 c, d16 c, d16 c, d16 c, d16 c, d16 c, d16 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 0 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d16 c, d16 c, d16 c, d16 c, d16 c, d16 c, d16 c, d16 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, d12 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 8 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 6 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 4 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 2 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, 1 c, \ =========================================================================== \ Variables \ =========================================================================== \ container for 8x8-Matrix table address wvariable table \ =========================================================================== \ Main \ =========================================================================== lockdict create _gray_scale_asm forthentry $C_a_lxasm w, h13E h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z4i]eB l, z2Wy]jG l, z2Wy]r8 l, z2Wya01 l, z2Wyxj0 l, z2WyxW0 l, z2WiPvv l, z1Sy][l l, z2Wix[r l, z2Wyxmy l, z2WiPvu l, z20iPyk l, z3ryPr0 l, z2Wya88 l, z2WyaG0 l, ziP[o l, z25iP[p l, z1bmaK0 l, zbyaG1 l, z20y]b1 l, z3[yaCY l, z2[iPnt l, z24yPj1 l, z2WixZE l, z2WiPvw l, z1Sy][l l, zfya01 l, z3[y]vN l, z4i]eB l, z3[y]nL l, z1SV04K l, z20iPyk l, z3ryPr0 l, z1SV000 l, 0 l, 0 l, 0 l, 0 l, 0 l, 0 l, z1[ l, zxW l, z1w0 l, freedict : demo pic1 table W! c" table _gray_scale_asm" 0 cogx begin pic1 d14 0 do dup table W! 8 + d50 delms loop drop fkey? swap drop until 0 cogreset ; { \ 16 Gray-scale-driver for 8x8-Matrix-LED by Charlieplexing \ Using P0 - P7 \ Top pin for drive is P0(=bit0) \ ( n1 -- ) n1:address of 8x8-Matrix table fl build_BootOpt :rasm rdword __addr , $C_stTOS __entry \ Repeat level[16] mov __level , # d16 __1 \ Reapet row[8] (scr1 to scr8) mov __row , # 8 mov __scr , # 1 __2 \ Set from P0 to P7 to Hi-Z (All LEDs off) mov dira , # 0 \ Set data to 0 mov outa , # 0 \ Wait to drive next SCR mov $C_treg4 , __50usec jmpret __delayret , # __delay \ each SCR on mov outa , __scr mov dira , # hFF mov $C_treg4 , __1.25usec add $C_treg4 , cnt waitcnt $C_treg4 , # 0 \ Making 8bit[8] mov __column , # 8 mov __matrix , # 0 __3 rdbyte $C_treg1 , __addr sub $C_treg1 , __level wc if_nc or __matrix , # h100 shr __matrix , # 1 \ Increment memory address add __addr , # 1 djnz __column , # __3 \ Output 8bit neg $C_treg3 , __matrix sub $C_treg3 , # 1 mov outa , $C_treg3 \ Delay 100usec mov $C_treg4 , __100usec jmpret __delayret , # __delay \ Shift scr 1bit shl __scr , # 1 djnz __row , # __2 rdword __addr , $C_stTOS djnz __level , # __1 jmp # __entry __delay add $C_treg4 , cnt waitcnt $C_treg4 , # 0 __delayret ret \ --- Variables --- \ Address of container __addr 0 \ Gradation data __level 0 \ row counter(scr) __row 0 \ scr data __scr 0 \ loop-counter for making 1byte __column 0 \ 1byte to matrix __matrix 0 \ --- Constants --- \ This value must be adjust when changing SCR __1.25usec d100 __50usec d4000 __100usec d8000 ;asm _gray_scale_asm }