HI.
I'm making 2_wire_LCD.
But not operating correctly.
After power on character-LCD, word'demo2' always firstly not operate correctly. (cimg3558.jpg)
But word'demo2' operate perfectly at second time.(cimg3559.jpg)
After power on character-LCD, word'demo1' never operate .
But after operated word'demo2', word'demo1' operate perfectly.
If curcuit is wrong, it should be NOT operate at all.
I think there are mistakes in forth-code or assembler-code.
But I have no idea.
Do you have any idea?
Hi.
i2c_charLCD and i2c_charLCD_II are codes for 1pc characterLCD.
CHaracterLCD can connect max 8pcs on SDA/SCL, because PCF8574 and MCP23017 have 3 address lines.
Of course, modification need.
Expected frequency(500k,1M,2M,4M) don't put out.
In case of 500kHz, pulse-width at Hi and Lo is different.
More than 10000kHz cannot observe by osciloscope.
Where does code wrong?
I modified a little.
DotCorrection data can read By StatusInformationOutput(SIO).
Removed wire connected to OUT3.
LED conncted to XERR is on.
But data(LOD) from SIO cannot read it.
Do you have any idea?
Prop0 Cog6 ok
demo220_72400_016:
20_724: 000004008012016020024028032036040044048052056060 ........ $(,048< <-- Data to write in DC-register
LOD:h0TEF:h020_72400_016:
20_724: 000004008012016020024028032036040044048052056060 ........ $(,048< <-- Reading data from DC-register by SIO
Prop0 Cog6 ok
CON:Prop0 Cog0 RESET - last status: 0 ok
There is statement in page18 of TLC5940.pdf below;
"The first GS data input cycle after dot correction requires an additional SCLK pulse after the XLAT signal to
complete the grayscale update cycle. All GS data in the input shift register is replaced with status information
data (SID) after updated the grayscale register."
It seems to need need 'SCLK pulse' if SIO need to get.
But it seems to to need update dot-correction register only 1 time.
I think it don't need to be care because strange is only first 1-time.
'Init_TLC5940' set d63 to Dot-Correction registers and 0 to Gray-Scale registers.
Not 'SCLK pulse'.
Photo of demo1 is cimg3583.
This change only gray-scale registers.
Photo of demo2 and demo3 is cimg3585.
This change only dot-correction registers.
Gra-scale registers are all d200.
demo217_78000_016:
17_780: 000004008012016020024028032036040044048052056060 ........ $(,048<
LOD:h132TEF:h13217_78000_016:
17_780: 032040048057001009017025033041049056000000000000 (09....!)18....
Prop0 Cog6 ok
CON:Prop0 Cog0 RESET - last status: 0 ok
demo2 don't use 'SCLK pulse' in init_TLC5940.
I think SIO data is meaningless.
demo317_78000_016:
17_780: 000004008012016020024028032036040044048052056060 ........ $(,048<
LOD:h0TEF:h017_78000_016:
17_780: 000004008012016020024028032036040044048052056060 ........ $(,048<
Prop0 Cog6 ok
CON:Prop0 Cog0 RESET - last status: 0 ok
demo3 use another code(using 'SCLK pulse') instead of 'init_TLC5940'.
I think Reading of Dot-correction registers is correct.
But reading of LOD is incorrect.
Photo of demo4 is cimg3586.
Front of demo4 don't use 'dc_update'.
It seems to be still d63 only dot-correction register of OUT15(right side LED of cimg3586).
In case of rear of demo4, all LEDs are same brightness.
I don't understand why only OUT15.
I cannot compare other chip because I have only 1pc TLC5940.
Sorry, I misunderstood about 1 SCLK-pulse.
I misunderstood SIO need 1 SCLK-pulse.
I understood dot-correction register need it.
When dot-correction register change, needing SCLK-pulse only first 1-time afterXLAT pulse.
Sorry, I misunderstood about 1 SCLK-pulse.
I misunderstood SIO need 1 SCLK-pulse.
I understood dot-correction register need it.
When dot-correction register change, needing SCLK-pulse only first 1-time afterXLAT pulse.
So did you get it worked out?
I'm about to start the call, but I don't have the part and driver is a little bit involved, I don't fully understand the situation.
Is the a question we should ask of Sal?
Problems were below;
1. When dot-corrections are changed, only OUT15's dot-correction don't change.
SCLK-pulse after XLAT solved this. ( I misunderstood reading from manual)
2.When getted SIO, LOD(16bit) is always '0'.
SIO(StatusInformationOutput)
b0 - b15 LOD(LED OPEN DETECTION) data
b16: TEF(THERMAL ERROR FLAG)
b17 - b23: unknown
b24 - b119: Dot Correction value
b120 - b191: Reserved
I think Dot Correction value can get from SIO.
But, maybe there are bugs in code because LOD cannot get.
Updated TLC5940 code.
Some LEDs is on because registers(GrayScale, DotCorrection) is unknown at power-on.
To prevent this, I think needing pulled up BLANK-pin.
Code need to modify.
Prop0 Cog6 ok
demo217_78000_016:
17_780: 000004008012016020024028032036040044048052056060 ........ $(,048< <-- data to write in DotCorrection registers
h4000 <--- LOD(OUT14 is open)
h0 <--- TEF(When bit7=1, thermalerror)
04812162024283236404448525660 <-- Reading data from DotCorrection registers
Prop0 Cog6 ok
Removed VFD from junk DVD-player.
VFD model is FHD81X18-0635.
MOSFET(2N7002) is used as level-shifter.
Displayed string'Forth' on VFD.
VFD-controller is PT6312.
I'm trying to display Adafruit matrix.
'demo' write values on d-buf and display them on d-buf.
'matrix_scan' display them on d-buf.
Photo is cimg3628.jpg.
[/] are drawed on surface on panel.
But 'c" matrix_scan" 0 cogx' indicate different result.
There are lines on 8th line of upper and lower.
Photo is cimg3629.jpg.
Prop0 Cog6 ok
hexProp0 Cog6 ok
demo <---- cimg3628.jpg
Prop0 Cog6 ok
matrix_scan <---- cimg3628.jpg
Prop0 Cog6 ok
cog d32 dump
49580020:
4958: C0090000010800004008000080080000 ........@.......
4968: C0080000010900004009000080090000 ........@.......
Prop0 Cog6 ok
c" matrix_scan"0 cogx <---- cimg3629.jpg
Prop0 Cog6 ok
cog d32 dump
49580020:
4958: C0090000010800004008000080080000 ........@.......
4968: C0080000010900004009000080090000 ........@.......
Prop0 Cog6 ok
[C B A] select line number on upper and lower.
I checked [C B A] from outa register on 'line_sh_out_u'.
Both are same.
Sorry, it was my mistake.
outa register on cog6 was h1C0 by 'demo'.
I forgot to clear outa register on cog6.
So, [C B A]value is always [1 1 1] although outa register on cog0 change.
8x8-font are displayd on upper section of Adafrui matrix16x32.
This is only 7colors.
Character data(including [A B C]line and [R1 G1 B1] and EN) are placed inside matrix_array(2048bytes).
'test2' continue to scan matrix_array(2048bytes).
But dot with [0 0 0] of [R1 G1 B1] is a little on.
Maybe I think this is ghost.
\ Scan matrix_array to display
\ ( -- )
: test2
hFFF dira COG!
matrix_array
begin
dup
d16 0do
d32 0do
a_matrix_16x32_2
loop
LE pinhi LE pinlo
EN pinlo
loop
drop
fkey? swap drop
until
drop
;
{
fl
\ ( n1 -- n2 ) n1:address of buffer
build_BootOpt :rasm
rdlong outa , $C_stTOSor outa , __clk
add $C_stTOS , # 4
jexit
__clk
h200
;asm a_matrix_16x32_2
}
Adafruit_matrix_0.2_2 is not normal code.
Not defined 2048bytes about array by code.
Before loading;
reboot
..
Prop0 Cog6 ok
variable matrix_array
matrix_array .
17616 Prop0 Cog6 ok <-- if dev-kerenel, it should be 17616.
19663 here W! <-- 'here' changed
Loaing Adafruit_matrix_0.2_2
Messages in TeraTerm should stop during loading code.
After hitting return-key, loading restart and finish.
Execute 'demo'
Before loading Adafruit_matrix_0.3, execute below;
reboot
..
Prop0 Cog6 ok
variable matrix_array
Prop0 Cog6 ok
matrix_array .
17616 Prop0 Cog6 ok <-- If Dev-kernel, it should be 17616.
d17616 d1024 + here W!
Prop0 Cog6 ok
If messages stop in TeraTerm window, it finish by hitting return-key.
Printed string"May the Forth be with you. " with green(2) on upper section(0) of Adafruit matrix16x32.
c" May the Forth be with you. " 2 0 adafruit_str
Printed string"May the Forth be with you. " with green(2) on upper section(0) of Adafruit matrix16x32.
c" May the Forth be with you. " 2 0 adafruit_str
Would you please include the forth code for the optimize instruction
a_matrix_16x32_2
as a comment if a version 0.5 is posted?
Is wvariable n an extra loop counter for the third outter loop? I always cringe when I see single character variable names.
I respect i and j for loop counters, those being the names used since the days when names were limited to 3 characters.
But all other names should have some clue at to what they are used for.
Other than than, very nice code, and very cool demo!
Could you maybe creat a wiki page? This is too cool to let it get lost.
n of 'prepare_array'is outer loop counter.
This indicate upper matric(8x32) or lower matrix(8x32).
\ Set each Long data of matrix_array toouta
\ ( n1 -- n2 ) n1:address of matrix_array n2:n1+2 <--- correct
lockdict create a_matrix_16x32_2 forthentry
$C_a_lxasm w, h118 h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l,
z4ixZB l, z1bix[N l, z20yPO2 l, z1SV01X l, z80 l,
freedict
{
fl
\ ( n1 -- n2 ) n1:address of buffer
build_BootOpt :rasm
rdword outa , $C_stTOS
or outa , __clk
add $C_stTOS , # 2
jexit
__clk
h200
;asm a_matrix_16x32_2
}
I'm writing code for printing ROM-chip font(16x16[JIS0208], 8x16[ASCII]).
Code for character finish next.
After it, I want to display full color picture.
I finded out Rayman's thread"Propellering the Adafruit 16x32xRGB LED array".
Maybe I think it cannot translate directly because this use "long OutputArray[32*8*8]"(8192bytes) on Adafruit mateix(16x32).
I cannot understand it yet.
Comments
I'm making 2_wire_LCD.
But not operating correctly.
After power on character-LCD, word'demo2' always firstly not operate correctly. (cimg3558.jpg)
But word'demo2' operate perfectly at second time.(cimg3559.jpg)
After power on character-LCD, word'demo1' never operate .
But after operated word'demo2', word'demo1' operate perfectly.
If curcuit is wrong, it should be NOT operate at all.
I think there are mistakes in forth-code or assembler-code.
But I have no idea.
Do you have any idea?
There were mistakes on procedure inside word'lcd_init' and delay time on another word.
Added MCP23017.
Updated i2c_utility.
Do you think you could check the wiki page for i2c_utility? Do should be able to edit and create pages.
Do you think you could add a page for MCP23017? Please give it a try.
Thanks!
Sorry, curcuit diagram of 2_wire_LCD was wrong. (Pin-number is correct.)
QA->QB, QB->QC, QC->QD, QD->QE, QE->QF, QF->QG, QG->QH
i2c_charLCD and i2c_charLCD_II are codes for 1pc characterLCD.
CHaracterLCD can connect max 8pcs on SDA/SCL, because PCF8574 and MCP23017 have 3 address lines.
Of course, modification need.
I think no one want to connect 8pcs characterLCD.
fl [ifndef ctra h1F8 wconstant ctra ] [ifndef frqa h1FA wconstant frqa ] [ifndef phsa h1FC wconstant phsa ] 4 wconstant xtal_out { Returns frq* register = frequency * (2exp32 / clkfreq) calculated with binary long division. This is faster than the floating point library, and takes less code space. this method is an adaptation of the CTR object's fraction method. Refering:Propeller Education Kif Labs Chapter7 Counter Modules and Curcuit Applications Lab page145 } \ ( n1 -- n2 ) n1:frequency(500000[500kHz] - 128000000[128MHz]) n2:frq* register : NcoFrqReg 0 \ initial frq* ( frequency frq* ) d33 0 do 1 lshift swap \ ( frq* frequency ) dup clkfreq >= \ ( frq* frequency 1/0 ) if clkfreq - swap 1+ swap then 1 lshift swap \ ( frequency frq* ) loop nip ; \ ( n1 -- ) n1:frequency : setup_freq dup NcoFrqReg ." frqa:" frqa COG@ . frqa COG! \ Calculate PLL divider d1000000 / 1 8 0 do i 0 <> if 2 u* then 2dup <= if 2drop i 8 seti then loop ." PLL divider:" dup . d23 lshift \ PLL divider h8000000 or \ PLL single-ended mode xtal_out or \ apin ." ctra:h" hex ctra COG@ . decimal cr ctra COG! xtal_out pinout \ Set xtal_out pin to output ;
Result are below;
Freq. Obsesation by oasilloscope 500k frqa:26843545 PLL divider:0 ctra:h8000004 58.8kHz Hi:10us Lo:7us 1000k frqa:53687091 PLL divider:0 ctra:h8000004 125 2000k frqa:107374182 PLL divider:1 ctra:h8800004 500k 4000k frqa:214748364 PLL divider:2 ctra:h9000004 2000 5000k frqa:268435456 PLL divider:3 ctra:h9800004 5000 6000k frqa:322122547 PLL divider:3 ctra:h9800004 6000 8000k frqa:429496729 PLL divider:3 ctra:h9800004 8000 10000k frqa:536870912 PLL divider:4 ctra:hA000004 20000k frqa:1073741824 PLL divider:5 ctra:hA8000004
Expected frequency(500k,1M,2M,4M) don't put out.
In case of 500kHz, pulse-width at Hi and Lo is different.
More than 10000kHz cannot observe by osciloscope.
Where does code wrong?
Pulse more than 20MHz cannot observe on my oscilloscope.
Maybe it seems to work well.
Freq. Obsesation by oasilloscope 500k frqa:214748364 PLL divider:0 ctra:h8000004 500kHz 1000k frqa:429496729 PLL divider:0 ctra:h8000004 1000kHz 2000k frqa:429496729 PLL divider:1 ctra:h8800004 2000kHz 4000k frqa:429496729 PLL divider:2 ctra:h9000004 4000 5000k frqa:268435456 PLL divider:3 ctra:h9800004 5000 6000k frqa:322122547 PLL divider:3 ctra:h9800004 6000 8000k frqa:429496729 PLL divider:3 ctra:h9800004 8000 10000k frqa:268435456 PLL divider:4 ctra:hA000004 10000 20000k frqa:268435456 PLL divider:5 ctra:hA800004
fl [ifndef ctra h1F8 wconstant ctra ] [ifndef frqa h1FA wconstant frqa ] [ifndef phsa h1FC wconstant phsa ] 4 wconstant xtal_out { Returns frq* register = frequency * (2exp32 / clkfreq) calculated with binary long division. This is faster than the floating point library, and takes less code space. this method is an adaptation of the CTR object's fraction method. Refering:Propeller Education Kif Labs Chapter7 Counter Modules and Curcuit Applications Lab page145 } \ ( n1 -- n2 ) n1:frequency(500000[500kHz] - 128000000[128MHz]) n2:frq* register : NcoFrqReg 0 \ initial frq* ( frequency frq* ) d33 0 do 1 lshift swap \ ( frq* frequency ) dup clkfreq >= \ ( frq* frequency 1/0 ) if clkfreq - swap 1+ swap then 1 lshift swap \ ( frequency frq* ) loop nip ; \ ( n1 -- ) n1:frequency (500000[500kHz] - 128000000[128MHz]) : setup_freq dup \ ( n1 n1 ) \ Calculate PLL divider d1000000 / 1 8 0 do i 0 <> if 2 u* then 2dup <= if 2drop i 8 seti then loop \ ( n1 PLL_divider ) dup >r \ Push PLL divider 2 swap 6 swap - 0 do 2 u* loop \ ( n1 2exp[7-PLL_divuder] ) u* \ ( VCO_frequency ) d16 u/ \ ( PHS_bit31_frequency ) NcoFrqReg frqa COG! ." frqa:" frqa COG@ . r> \ Pop PLL divider ." PLL divider:" dup . d23 lshift \ PLL divider h8000000 or \ PLL single-ended mode xtal_out or \ apin ctra COG! ." ctra:h" hex ctra COG@ . decimal cr xtal_out pinout \ Set xtal_out pin to output ;
DotCorrection data can read By StatusInformationOutput(SIO).
Removed wire connected to OUT3.
LED conncted to XERR is on.
But data(LOD) from SIO cannot read it.
Do you have any idea?
Prop0 Cog6 ok demo2 20_724 00_016: 20_724: 000 004 008 012 016 020 024 028 032 036 040 044 048 052 056 060 ........ $(,048< <-- Data to write in DC-register LOD:h0 TEF:h0 20_724 00_016: 20_724: 000 004 008 012 016 020 024 028 032 036 040 044 048 052 056 060 ........ $(,048< <-- Reading data from DC-register by SIO Prop0 Cog6 ok CON:Prop0 Cog0 RESET - last status: 0 ok
There is statement in page18 of TLC5940.pdf below;
"The first GS data input cycle after dot correction requires an additional SCLK pulse after the XLAT signal to
complete the grayscale update cycle. All GS data in the input shift register is replaced with status information
data (SID) after updated the grayscale register."
It seems to need need 'SCLK pulse' if SIO need to get.
But it seems to to need update dot-correction register only 1 time.
I think it don't need to be care because strange is only first 1-time.
'Init_TLC5940' set d63 to Dot-Correction registers and 0 to Gray-Scale registers.
Not 'SCLK pulse'.
Photo of demo1 is cimg3583.
This change only gray-scale registers.
Photo of demo2 and demo3 is cimg3585.
This change only dot-correction registers.
Gra-scale registers are all d200.
demo2 17_780 00_016: 17_780: 000 004 008 012 016 020 024 028 032 036 040 044 048 052 056 060 ........ $(,048< LOD:h132 TEF:h132 17_780 00_016: 17_780: 032 040 048 057 001 009 017 025 033 041 049 056 000 000 000 000 (09....!)18.... Prop0 Cog6 ok CON:Prop0 Cog0 RESET - last status: 0 ok
demo2 don't use 'SCLK pulse' in init_TLC5940.I think SIO data is meaningless.
demo3 17_780 00_016: 17_780: 000 004 008 012 016 020 024 028 032 036 040 044 048 052 056 060 ........ $(,048< LOD:h0 TEF:h0 17_780 00_016: 17_780: 000 004 008 012 016 020 024 028 032 036 040 044 048 052 056 060 ........ $(,048< Prop0 Cog6 ok CON:Prop0 Cog0 RESET - last status: 0 ok
demo3 use another code(using 'SCLK pulse') instead of 'init_TLC5940'.I think Reading of Dot-correction registers is correct.
But reading of LOD is incorrect.
Photo of demo4 is cimg3586.
Front of demo4 don't use 'dc_update'.
It seems to be still d63 only dot-correction register of OUT15(right side LED of cimg3586).
In case of rear of demo4, all LEDs are same brightness.
I don't understand why only OUT15.
I cannot compare other chip because I have only 1pc TLC5940.
I misunderstood SIO need 1 SCLK-pulse.
I understood dot-correction register need it.
When dot-correction register change, needing SCLK-pulse only first 1-time afterXLAT pulse.
Sorry, I often have written wrong thing.
So did you get it worked out?
I'm about to start the call, but I don't have the part and driver is a little bit involved, I don't fully understand the situation.
Is the a question we should ask of Sal?
Problems were below;
1. When dot-corrections are changed, only OUT15's dot-correction don't change.
SCLK-pulse after XLAT solved this. ( I misunderstood reading from manual)
2.When getted SIO, LOD(16bit) is always '0'.
SIO(StatusInformationOutput)
b0 - b15 LOD(LED OPEN DETECTION) data
b16: TEF(THERMAL ERROR FLAG)
b17 - b23: unknown
b24 - b119: Dot Correction value
b120 - b191: Reserved
I think Dot Correction value can get from SIO.
But, maybe there are bugs in code because LOD cannot get.
Communication is SPI.
This font is mainly JIS0208.
So, I think maybe this chip is worthless for many propeller users.
Prop0 Cog6 ok demo 17_648 00_032: 17_648: 000 000 000 000 192 176 140 130 140 176 192 000 000 000 000 000 ................ 17_664: 000 008 012 011 000 000 000 000 000 000 000 011 012 008 000 000 ................ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 17_648 00_032: 17_648: 128 128 064 064 032 032 016 016 008 008 004 004 002 002 000 000 ..@@ .......... 17_664: 000 000 001 001 002 002 004 004 008 008 016 016 032 032 000 000 ............ .. * * * * * * * * * * * * * * * * * * * * * * * * * * 17_648 00_032: 17_648: 032 016 232 036 039 036 036 228 036 052 044 032 224 000 000 000 ..$'$$.$4, .... 17_664: 000 000 063 066 066 066 066 067 066 066 066 066 067 064 120 000 ..?BBBBCBBBBC@x. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 17_648 00_032: 17_648: 000 002 226 034 034 254 034 034 034 254 034 034 226 002 000 000 ...""."""."".... 17_664: 064 064 071 068 068 127 068 068 068 127 068 068 071 064 064 000 @@GDD.DDD.DDG@@. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 17_648 00_032: 17_648: 000 254 034 090 134 016 012 036 036 037 038 036 036 020 012 000 .."Z...$$%&$$... 17_664: 000 255 004 008 007 128 065 049 015 001 001 063 065 065 113 000 ......A1...?AAq. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Prop0 Cog6 ok
Some LEDs is on because registers(GrayScale, DotCorrection) is unknown at power-on.
To prevent this, I think needing pulled up BLANK-pin.
Code need to modify.
Prop0 Cog6 ok demo2 17_780 00_016: 17_780: 000 004 008 012 016 020 024 028 032 036 040 044 048 052 056 060 ........ $(,048< <-- data to write in DotCorrection registers h4000 <--- LOD(OUT14 is open) h0 <--- TEF(When bit7=1, thermalerror) 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 <-- Reading data from DotCorrection registers Prop0 Cog6 ok
VFD model is FHD81X18-0635.
MOSFET(2N7002) is used as level-shifter.
Displayed string'Forth' on VFD.
VFD-controller is PT6312.
Displayed font in ROM-chip on GraphicLCD(WD-G2406B).
Refered curcuit and code about WD-G2406B beliow;
#460 http://forums.parallax.com/showthread.php/138399-Propforth-5.0-is-available-for-download/page23
#31 in this thread.
I bought Adafruit 16X32 matrix.
http://www.adafruit.com/products/420
Yet only this.
http://youtu.be/1mvWV2u12is
I'm trying to display Adafruit matrix.
'demo' write values on d-buf and display them on d-buf.
'matrix_scan' display them on d-buf.
Photo is cimg3628.jpg.
[/] are drawed on surface on panel.
But 'c" matrix_scan" 0 cogx' indicate different result.
There are lines on 8th line of upper and lower.
Photo is cimg3629.jpg.
Prop0 Cog6 ok hex Prop0 Cog6 ok demo <---- cimg3628.jpg Prop0 Cog6 ok matrix_scan <---- cimg3628.jpg Prop0 Cog6 ok cog d32 dump 4958 0020: 4958: C0 09 00 00 01 08 00 00 40 08 00 00 80 08 00 00 ........@....... 4968: C0 08 00 00 01 09 00 00 40 09 00 00 80 09 00 00 ........@....... Prop0 Cog6 ok c" matrix_scan" 0 cogx <---- cimg3629.jpg Prop0 Cog6 ok cog d32 dump 4958 0020: 4958: C0 09 00 00 01 08 00 00 40 08 00 00 80 08 00 00 ........@....... 4968: C0 08 00 00 01 09 00 00 40 09 00 00 80 09 00 00 ........@....... Prop0 Cog6 ok
[C B A] select line number on upper and lower.
I checked [C B A] from outa register on 'line_sh_out_u'.
Both are same.
Why result is different?
Any idea?
fl { Adafruit 16X32 Matrix PropForth 5.5 2014/06/18 14:28:55 Adafruit 16X32 Matrix ------------------------- | b31 ...... b0 | [ 0 0 0 ] | upper matrix(8x32) | ... upper matrix(8x32) color[ B1 G1 R1 ] | | [ 1 1 1 ] |-------------------------| | b31 ...... b0 | [ 0 0 0 ] | lower matrix(8x32) | ... lower matrix(8x32) color[ B2 G2 R2 ] | | [ 0 0 0 ] ------------------------- ^ ^ output signal side Input signal side } \ =========================================================================== \ Constants \ =========================================================================== \ Pin 0 wconstant R1 1 wconstant G1 2 wconstant B1 3 wconstant R2 4 wconstant G2 5 wconstant B2 6 wconstant LnA 7 wconstant LnB 8 wconstant LnC 9 wconstant CLK d10 wconstant LE d11 wconstant EN 7 R1 lshift invert constant upper_m \ mask bit for upper-matrix 7 R2 lshift invert constant lower_m \ mask bit for lower-matrix 7 LnA lshift invert constant line_m \ mask bit for line \ =========================================================================== \ Variables \ =========================================================================== \ display-buffer for Adafruit matrix 16x32 variable d_buf d60 allot \ =========================================================================== \ Main \ =========================================================================== : setup R1 d12 0 do dup pinout 1+ loop drop EN pinhi ; variable cog d28 allot \ Display 1 line for upper \ ( n1 n2 -- ) n1:32bits n2:line number : line_sh_out_u EN pinhi \ outa COG@ . outa COG@ over 4 * cog + L! \ check [C B A] LnA lshift outa COG@ line_m and or outa COG! h8000_0000 d32 0 do 2dup and if R1 pinhi else R1 pinlo then CLK pinhi CLK pinlo 1 rshift loop LE pinhi LE pinlo EN pinlo 2drop ; \ Display 1 line for lower \ ( n1 n2 -- ) n1:32bits n2:line number : line_sh_out_l EN pinhi LnA lshift outa COG@ line_m and or outa COG! h8000_0000 d32 0 do 2dup and if R2 pinhi else R2 pinlo then CLK pinhi CLK pinlo 1 rshift loop LE pinhi LE pinlo EN pinlo 2drop ; \ Scan Adafruit matrix 16X32 \ ( -- ) : matrix_scan setup d_buf begin dup 8 0 do dup L@ i line_sh_out_u 4+ loop 8 0 do dup L@ i line_sh_out_l 4+ loop drop fkey? swap drop until drop ; : demo d_buf dup h11111111 swap L! 4+ dup h22222222 swap L! 4+ dup h44444444 swap L! 4+ dup h88888888 swap L! 4+ dup h11111111 swap L! 4+ dup h22222222 swap L! 4+ dup h44444444 swap L! 4+ dup h88888888 swap L! 4+ dup h11111111 swap L! 4+ dup h22222222 swap L! 4+ dup h44444444 swap L! 4+ dup h88888888 swap L! 4+ dup h11111111 swap L! 4+ dup h22222222 swap L! 4+ dup h44444444 swap L! 4+ h88888888 swap L! \ c" matrix_scan" 0 cogx matrix_scan ;
Or does it work on cog 6, and not on cog 0?
In both those cases I would guess something didn't get initialized.
Or the pin states that are set by one cog are not reset by the other cog.
If you reboot, and reload the code and run it on cog 0 without running on cog 6, does it have a different result?
That's all that comes to mind at the moment
outa register on cog6 was h1C0 by 'demo'.
I forgot to clear outa register on cog6.
So, [C B A]value is always [1 1 1] although outa register on cog0 change.
8x8-font are displayd on upper section of Adafrui matrix16x32.
This is only 7colors.
Character data(including [A B C]line and [R1 G1 B1] and EN) are placed inside matrix_array(2048bytes).
'test2' continue to scan matrix_array(2048bytes).
But dot with [0 0 0] of [R1 G1 B1] is a little on.
Maybe I think this is ghost.
http://youtu.be/6UtN6g117GE
\ Scan matrix_array to display \ ( -- ) : test2 hFFF dira COG! matrix_array begin dup d16 0 do d32 0 do a_matrix_16x32_2 loop LE pinhi LE pinlo EN pinlo loop drop fkey? swap drop until drop ; { fl \ ( n1 -- n2 ) n1:address of buffer build_BootOpt :rasm rdlong outa , $C_stTOS or outa , __clk add $C_stTOS , # 4 jexit __clk h200 ;asm a_matrix_16x32_2 }
Adafruit_matrix_0.2_2 is not normal code.
Not defined 2048bytes about array by code.
Before loading;
reboot .. Prop0 Cog6 ok variable matrix_array matrix_array . 17616 Prop0 Cog6 ok <-- if dev-kerenel, it should be 17616. 19663 here W! <-- 'here' changed
Loaing Adafruit_matrix_0.2_2Messages in TeraTerm should stop during loading code.
After hitting return-key, loading restart and finish.
Execute 'demo'
Before loading Adafruit_matrix_0.3, execute below;
reboot .. Prop0 Cog6 ok variable matrix_array Prop0 Cog6 ok matrix_array . 17616 Prop0 Cog6 ok <-- If Dev-kernel, it should be 17616. d17616 d1024 + here W! Prop0 Cog6 ok
If messages stop in TeraTerm window, it finish by hitting return-key.http://youtu.be/iTCAMwFCZe4
Printed string"May the Forth be with you. " with green(2) on upper section(0) of Adafruit matrix16x32.
c" May the Forth be with you. " 2 0 adafruit_str
Would you please include the forth code for the optimize instruction
a_matrix_16x32_2
as a comment if a version 0.5 is posted?Is wvariable n an extra loop counter for the third outter loop? I always cringe when I see single character variable names.
I respect i and j for loop counters, those being the names used since the days when names were limited to 3 characters.
But all other names should have some clue at to what they are used for.
Other than than, very nice code, and very cool demo!
Could you maybe creat a wiki page? This is too cool to let it get lost.
n of 'prepare_array'is outer loop counter.
This indicate upper matric(8x32) or lower matrix(8x32).
\ Set each Long data of matrix_array to outa \ ( n1 -- n2 ) n1:address of matrix_array n2:n1+2 <--- correct lockdict create a_matrix_16x32_2 forthentry $C_a_lxasm w, h118 h113 1- tuck - h9 lshift or here W@ alignl h10 lshift or l, z4ixZB l, z1bix[N l, z20yPO2 l, z1SV01X l, z80 l, freedict { fl \ ( n1 -- n2 ) n1:address of buffer build_BootOpt :rasm rdword outa , $C_stTOS or outa , __clk add $C_stTOS , # 2 jexit __clk h200 ;asm a_matrix_16x32_2 }
I'm writing code for printing ROM-chip font(16x16[JIS0208], 8x16[ASCII]).Code for character finish next.
After it, I want to display full color picture.
I finded out Rayman's thread"Propellering the Adafruit 16x32xRGB LED array".
Maybe I think it cannot translate directly because this use "long OutputArray[32*8*8]"(8192bytes) on Adafruit mateix(16x32).
I cannot understand it yet.