Pages: 1 2 3 [4]   Go Down
Author Topic: High speed vector graphics engine. 3.2" TFT Lcd screen.  (Read 19232 times)
0 Members and 1 Guest are viewing this topic.
Istanbul
Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi there pYro_65,
are you following this topic, do you plan to share your results as you wrote?
regards,
K
Logged

Objects are what is unalterable and subsistent;
their configuration is what is changing and unstable.
L.W.

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi i tried the above library it is much faster wow but.
 i do have a problem i use 2 interupts pin 18 and 19 for my speedometer and rev counter

,the code and pins work fine with hennings library , is there anyway to fix this again .
please would be great to use the extra speed i am making a trip computer , for a car ,
 i use  hall sensors to get trigger from wheel and camshaft , via interupts ,

 also i sense inject pulse via a optocoupler , i had all this working on my 128x64 glcd but decided i wanted touch and touch start ,

please please any ideas thanks
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I know this topic is a bit old, but... has the pyro_65 work been lost or with mäel optimization is just 'enough' improvement?

I see pyro_65 is still quite (a lot) active in the forum...
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 69
Posts: 2165
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No, my work isn't lost. Its just unfinished on an old hard drive. I have lots of things happening at the moment however I do want to put the parts I did finish up on my website one day.

I'll have to dig out the hard drive, however there were some problems with the library. It only works on certain SSD1289 displays. Some versions use different resistors in the COG panel and cannot use some of its features. I have a few programs using the library now, so it is not lost yet.

Logged


Offline Offline
Full Member
***
Karma: 4
Posts: 248
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is my UTFT version with optimizations speed of execution and ROM space used.

BE CAREFUL : It's work only with SSD1289 screen on Arduino Mega.
Screen : SainSmart 3.2" TFT LCD Display+Touch Panel+PCB adapter SD Slot for Arduino 2560,
Shield : SainSmart TFT LCD Adjustable Shield for Arduino Mega 2560 R3 1280 A082 Plug.

To optimize I examined the most frequently used functions.
For example:
drawPixel calls SetXY, SetXY makes a test on the target screen and calls LCD_Write_COM, it calls LCD_Write_COM and LCD_Write_DATA, they test the type of transfer and call LCD_Writ_Bus. LCD_Writ_Bus tests the type of target screen and then writes the data to the destination ports of the screen !!!
LCDxxx methods are called very often then it is they need to optimize.
I remove the tests "switch (mode)" or "if (display_transfer_mode! = 1)", which become useless if I still have the same screen.
I'm simplifying and removing cascades calls are expensive (passing parameters to the stack, context switching, etc.).

In the zip archive, I put a new example : Bench.ino (use this one to test), I removed some tools.

I also made a mode "x terminal" which sending display information to the serial port.
I wrote a program (in C #) that runs on the PC, he receives display information and draws on the PC screen: this is a simulator screen.
I left this feature in the code archive. It is off by a compiler directive (so this code is disabled).
Example :

Code:
void UTFT::drawPixel(int x, int y)
{
//don't worry about this code. this code is not compiled (Terminal_x not defined)
#ifdef TERMINAL_X
  //terminal x
  //0x81 [ID], [size], [datas]  
  uint8_t Trame[7];
  Trame[0] = 0x81; //ID de Terminal X
  Trame[1] = sizeof(Trame)-1; //taille de la sous-trame (à partir de cet endroit, on compte la size mais pas l'ID termX
  Trame[2] = TX_DRAWPIXEL; //ID ordre d'aff pixel
  Trame[3] = x >> 8; //MSB x1
  Trame[4] = x; //LSB x1
  Trame[5] = y >> 8;
  Trame[6] = y;
  Serial.write(Trame, sizeof(Trame));
  //return;
#endif
...

If anyone is interested, I can share my C # program...
I preferred share code in the current state, because if I take the time to clean it before, it will never be perfect and finally I will send nothing  smiley-wink

Finally, Perhaps the best is make a depot GIT.
I hope that pYro_65 will could give us his optimizations or ideas for a common version. smiley

(Sorry if I speak bad English, I took lessons smiley-wink )

bye.
Maël.

hello Mael, I am using your optimized  library and I congratulate you because it's really fast.
But I have a problem, with the original UTFT I used also  libraries UTFT_tinyFAT and UTFT_Geometry while your library can not use them, it gives me an error. You probably need to be changed.
Can you help me somehow?
Or is there someone else who can help me?
thanks
Excuse me for my LITTLE English  smiley-kiss
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just tried Mael library version but... just... white screen, nothing more. I think my LCD is the same as yours. Any help?

Anyway I got those results (As I cannot see anything drawn I'm not sure if they can be trusted):
ready.
start...
37252 us : clrScr
24 us : DrawPixel
228 us : DrawPixel x 10
8 us : SetColor
8 us : SetBackColor
5800 us : FillRoundRect 40x40
636 us : DrawRoundRect 40x40
916 us : drawLine 40x40
152 us : draw Vertical Line 40
144 us : draw Horizontal Line 40
1484 us : FillRect 40x40
8 us : SetSmallFont
2300 us : Print 001
2300 us : Print Abc
2584 us : printNumI(123)
12 us : SetBigFont
4336 us : Print 001
4420 us : printNumI(123)
2416 us : draw bitmap 32x32
16 us : Touch Screen DataAvailable
40 us : Touch Screen Read
16 us : Touch Screen getX, getY
finish in 84308 us.


With the original library:

ready.
start...
114588 us : clrScr
212 us : DrawPixel
2064 us : DrawPixel x 10
12 us : SetColor
8 us : SetBackColor
14500 us : FillRoundRect 40x40
2244 us : DrawRoundRect 40x40
4160 us : drawLine 40x40
472 us : draw Vertical Line 40
472 us : draw Horizontal Line 40
4368 us : FillRect 40x40
16 us : SetSmallFont
7396 us : Print 001
7212 us : Print Abc
7468 us : printNumI(123)
8 us : SetBigFont
13552 us : Print 001
13676 us : printNumI(123)
11084 us : draw bitmap 32x32
16 us : Touch Screen DataAvailable
40 us : Touch Screen Read
16 us : Touch Screen getX, getY
finish in 217392 us.


pYro_65, I would like you to consider to just post your library as it is. You/We can always improve it later smiley

by the way... has anybody seen this? Seems very related: http://gizmogarage.net/c-vs-assembler-performance-on-avr/

Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13664
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just tried Mael library version but... just... white screen, nothing more. I think my LCD is the same as yours. Any help?

Anyway I got those results (As I cannot see anything drawn I'm not sure if they can be trusted):
...
pYro_65, I would like you to consider to just post your library as it is. You/We can always improve it later smiley

by the way... has anybody seen this? Seems very related: http://gizmogarage.net/c-vs-assembler-performance-on-avr/
factor 2.5 is not bad, pity it didn't show anything.
imho you can trust these numbers (90% confidence) as they are not that extreme faster (even one slower)

Bookmarked that gizmogarage video. (awesome)
But as the author says it is generic code versus optimized dedicated code.
Really useful when you have a need for speed!
thanks for that link.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Ayer, Massachusetts, USA
Offline Offline
Edison Member
*
Karma: 54
Posts: 1847
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I dunno, if you have a need for speed, the first thing you should do is move up to a faster processor.  You can get Arm processors that support the Arduino libraries that run 4-8 times faster than a Mega (Teensy 3.1 runs at 96Mhz compared to 16Mhz for the Mega, and given the Teensy is a 32-bit processor, it means it does things in fewer cycles, which gives you an additional boost in speed).

Then if you are willing to change platforms, the Linux SBC's (single board computer) will run much, much faster, and they have hardware floating point in case you need it (Beaglebone Black runs at 1Ghz, Rasberry Pi at 700Mhz).
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 216
Posts: 13664
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

agree, but imho part of the Arduino fun is to get "most" speed from a "slow" processor
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 1
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Hernexto: Are you sure that you used the right init for the TFT?

I had to replace
Code:
UTFT myGLCD(0);
with
Code:
UTFT myGLCD(ITDB32S,38,39,40,41);

to get it working. I also had to add one "nop" in HW_AVR_defines.h to remove some unwanted glitch:

Code:
#define pulse_low_WR PORTG &= ~(1<<2); __asm__ volatile ("nop"); __asm__ volatile ("nop"); __asm__ volatile ("nop"); __asm__ volatile ("nop"); PORTG |= (1<<2)

BTW: I have tried to merge Maels extensions with the 2.75 version of Henning Karlsens UTFT to get UTFT_tinyFAT working and so that I can use
Code:
myGLCD.setBackColor(VGA_TRANSPARENT);

I have tested my result with Hennings "UTFT_Demo_320x240", Maels "Bench" and my own little Demo that uses SD card access with UTFT_tinyFAT and UTouch as well as UTFT. My attached version includes the additional "nop" already. Works fine for me, maybe you find it useful as well.

Maels "Bench" runs in 91720 usec instead of 217292 usec.

* UTFT_optimised_275.zip (2677.34 KB - downloaded 36 times.)
Logged

Pages: 1 2 3 [4]   Go Up
Jump to: