slow spin
I have built a 60x14 led display(840 pixels) with the following code there is a visible blink.
my math says 80MHz/60/840=1587 cycles per pixel to not blink. cant figure out how the interpreter could be that slow
dira[noparse][[/noparse]25..16]~~
repeat
repeat ubVb from 0 to 13
outa[noparse][[/noparse]25..22]:=ubVb
Multi:=1<<ubVb
repeat ubVa from 0 to 59
if Long[noparse][[/noparse]@ulDisplay][noparse][[/noparse]ubVa]&Multi
outa[noparse][[/noparse]21..16]:=ubVa
else
outa[noparse][[/noparse]21..16]:=$3F
my math says 80MHz/60/840=1587 cycles per pixel to not blink. cant figure out how the interpreter could be that slow

Comments
I'd recommend you use assembly for that or you split it across two COGs (with SPIN) but you may need to rewire part of your matrix. Asm is the way to go
ASM is the solution
Spin is·slow
Spin control is useful for processes that do not need speed
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Does the curiosity killed the cat?
DAT ulDisplay long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 DAT org 0 'Set Direction Display mov dira,#PINSDIR 'Set to begining of dislay :main mov ulY,#0 'zero ulY 'Initialize output to start processing row :outer mov temp,ulY 'copy to temp shl temp,22 'rotate to match output pins or temp,#LEDOFF 'turn all leds off mov outa,temp 'set output pins 'Set to begining of row mov ulX,#0 'Set to first pixel of row mov ptrToX,#ptrToDisplay 'copy display pointer 'Calculate pixel mask mov ulM,#1 'Set ulM to 1 shl ulM,ulY 'Shift left to proper bit ' 'Calculate if pixel is on or off :inner rdlong temp,ptrToX and temp,ulM cmp temp,#0 WZ 'Calculate output state mov temp,ulX shl temp,16 if_z mov outa,#LEDOFF 'turn led off if_nz or outa,temp 'turn led on 'Set for next pixel add ulX,#1 add ptrToX,#1 'See if finished line cmp ulX,#60 WZ if_nz jmp #:inner 'See if finished display add ulY,#1 cmp ulY,#14 WZ if_nz jmp #:outer jmp #:main 'Locale Time Value ulX long 0 ulY long 0 ulM long 0 ptrToDisplay long 0 ptrToX long 0 temp long 0 'constants LEDOFF long $003F0000 PINSDIR long $03FF0000 fit 496This problem is also present with #ptrToDisplay which again produces the address of the register in the cog's rams, not the stuff in the address.
Those are the biggest flaws I see in the code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 1/21/2009 3:52:58 AM GMT
DAT org 0 'Set Direction Display mov dira,PINSDIR 'Set to begining of dislay :main mov ulY,#0 'zero ulY 'Initialize output to start processing row :outer mov ulLineMask,ulY 'copy to temp shl ulLineMask,#22 'rotate to match output pins 'Set to begining of row mov ulX,#0 'Set to first pixel of row mov ptrToX,ptrToDisplay 'copy display pointer 'Calculate pixel mask mov ulM,#1 'Set ulM to 1 shl ulM,ulY 'Shift left to proper bit ' 'Calculate if pixel is on or off :inner rdlong temp,ptrToX and temp,ulM cmp temp,#0 WZ 'Calculate output state mov temp,ulX 'Copy current X value shl temp,#16 'Shift X value to align with output pins or temp,ulLineMask 'Add Y portion if_z mov outa,LEDOFF 'turn led off if_nz mov outa,temp 'turn led on 'Set for next pixel add ulX,#1 add ptrToX,#1 'See if finished line cmp ulX,#60 WZ if_nz jmp #:inner 'See if finished display add ulY,#1 cmp ulY,#14 WZ if_nz jmp #:outer jmp #:main 'Locale Time Value ulX long 0 ulY long 0 ulM long 0 ptrToDisplay long 0 ptrToX long 0 temp long 0 ulLineMask long 0 'constants LEDOFF long $003F0000 PINSDIR long $03FF0000 fit 496