jazzed wrote: »
I fail to understand what grudge match or language war has to do with this topic.
KMyers wrote: »
Very interesting thread. Does anyone have a RS part number? Havent been able to find one here in the boonies.
David Betz wrote: »
I guess if you're unwilling to use PASM with C then it will perform worse than Spin+PASM. I'm not sure where the complexity of the sketch came in. Are you talking about the sketch itself plus all of the libraries required to use it? Anyway, it is certainly much easier to use Spin+PASM than it is to use C+PASM. However, the need to use Spin+PASM is mostly due to the fact that Spin often doesn't perform well enough to use on its own.
pub sendMultiData(data, qty)
if qty > 1
pasm_mailbox := (qty - 1) << 8 + pmb_repeat
repeat while pasm_mailbox <> 0
cavelamb wrote: »
On the other topic, I may be wrong about this, but it seem to me that Spin IS the high level language for the Propeller.
It's back to that whole Von-Gracey architecture thing.
Spin is an interpreter-in-ROM, somewhat like the original Apple, TRS-80' etc computers of the olden days, but the
whole machine was boiled down to a single chip (ok and eeprom, but you get the idea).
It's a whole lot of power in a very tiny and unique package.
SwimDude0614 wrote: »
New numbers. All tests were run printing the text "Happy!" (I say this because I'm noticing significant differences in both C++ and Spin when the characters change - even with the same number of characters). PropWare::SeeedTFT is basically the original Arduino code, just ported to use some PropWare classes instead of Arduino. PropWare::SeeedTFTFast has been modified to use the PASM cog exactly as localroger posted in his example.
PropWare::SeeedTFT w/ CMM
- Init: 12.758 seconds
- Text: 7.883 seconds
PropWare::SeeedTFT w/ LMM
- Init: 3.040 seconds
- Text: 1.678 seconds
PropWare::SeeedTFTFast w/ CMM
- Init: 0.552 seconds
- Text: 1.490 seconds
PropWare::SeeedTFTFast w/ LMM
- Init: 0.550 seconds
- Text: 0.354 seconds
- Init: 0.638 seconds
- Text: 0.225 seconds
These results sure do intrigue me! I have no idea why printing text from PropWare::SeeedTFTFast with LMM is so much slower than Spin.This link provides the exact commit with the code used in PropWare.
And I've attached the Spin file that I used (I just added the Parallax Serial Terminal and some print statements)
SeeedStudio Touchscreen TFT Driver
This code is more or less directly translated from the Spin code by Jazzed
which was more or less directly translated from the Arduino source.
Some code and timing optimizations made.
--- define some aliases to match the Spin code better
ALIAS SHL <<
ALIAS SHR >>
ALIAS OUTCLR LOW
ALIAS OUTSET HIGH
11_1111_1100 == tftdat --- all pins
'' Basic Colors
$F800 == RED
$07E0 == GREEN
$001F == BLUE
$0000 == BLACK
$FFE0 == YELLOW
$FFFF == WHITE
'' Other Colors
$07FF == CYAN
$F810 == BRIGHT_RED
$8410 == GRAY1
$4208 == GRAY2
'' TFT resolution 240*320
0 == MIN_X
0 == MIN_Y
240 == MAX_X
320 == MAX_Y
'' pin definitions from tft.h. The pin manipulation
$04 8 << == CS
$08 8 << == RS
$10 8 << == WR
$20 8 << == RD
'' Macro definitions for char display direction
0 == LEFT2RIGHT
1 == DOWN2UP
2 == RIGHT2LEFT
3 == UP2DOWN
( define a couple of words to make the tables look more like the Spin version )
pub GETCSV "," delim C! GETWORD NUMBER ;
pub bytes IMMEDIATE BEGIN GETCSV WHILE codes W@ C! DROP 1 ALLOT REPEAT ;
pub words IMMEDIATE BEGIN GETCSV WHILE codes W@ W! DROP 2 ALLOT REPEAT ;
( Table includes delays and EOT codes )
1 ms P@ 2 >> >B
pub pushData ( byte --- ) --- 10.8us
2 << HIGH
CLOCK CLOCK --- strobe the WR line low high
pub sendData ( data -- ) --- 35.6us
\\\ RS HIGH ( redundant)
\\\ RD HIGH ( redundant)
W>B pushData pushData --- WriteData (16-bits)
pub sendCommand ( index -- ) --- 45.2us
RS LOW send16
RS HIGH --- returns RS back to default data select
pub readRegister ( index -- data )
tftdat INPUTS --- place data bus into read state
\\\ RS HIGH ( redundant)
--- strobe RD and read data
RD LOW RD HIGH getData 8 <<
RD LOW RD HIGH getData OR
pri SendCmdSeq ( ptr -- )
DUP W@ --- fetch a code from the table
IF ( sequence control code )
2+ DUP W@ --- read next word as either a delay or an end of table (0)
?DUP IF ms ELSE DROP EXIT THEN
DUP W@ sendCommand
2+ DUP W@ sendData
pub init --- 3.433sec
CS HIGH --- set control pins as inactive outputs
WR 4 COGREG! --- setup WR as a STROBE op (slightly faster)
InitSeq SendCmdSeq --- 403.6ms (inc 400ms of delays)
--- init cascades into the clearScreen function
pub clearScreen --- 4.8sec ; 3.7sec using CLOCK CLOCK for WR strobe ; 3.1sec by disabling redundant ops
MAX_X MAX_Y * FOR BLACK sendData NEXT
Heater. wrote: »
I don't quite follow what you have done. You have results:PropWare::SeeedTFTFast w/ CMM- Init: 0.552 seconds- Text: 1.490 secondsPropWare::SeeedTFTFast w/ LMM - Init: 0.550 seconds- Text: 0.354 secondsSS_TFT_PASMR.spin- Init: 0.638 seconds- Text: 0.225 seconds
and then say "I have no idea why printing text with LMM is so much slower than Spin."
Now the name of the Spin file implies it uses PASM where as there is no mention of PASM for the C files.
That implies the Spin code contains PASM to do the heavy lifting but the C code does not.
Is this the case or not? If it is you are not comparing Spin and C but rather PASM and C.
PropWare::SeeedTFTFast has been modified to use the PASM cog exactly as localroger posted in his example.
David Betz wrote: »
I think he modified the C code to call the PASM helpers:
Spin + PASM:
compiled with openspin SS_TFT_PASMR.spin
size: 3868 bytes
Initialization time: 638 ms
Text print time: 225 ms
CMM + PASM:
compiled with spin2cpp --binary -Os -mcmm SS_TFT_PASMR.spin
size: 7236 bytes (5700 bytes w/o kernel)
Initialization time: 635 ms
Text print time: 106 ms
LMM + PASM:
compiled with spin2cpp --binary -Os -mlmm SS_TFT_PASMR.spin
size: 11308 bytes (9996 bytes w/o kernel)
Initialization time: 550 ms
Text print time: 26 ms