Author Topic: Your 83+'s display is too small?  (Read 18428 times)

0 Members and 1 Guest are viewing this topic.

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Your 83+'s display is too small?
« on: April 03, 2013, 06:17:29 am »
I had an WG240128b graphics LCD (with the famous T6963 chip) lying around and I finally got it working with my 83+ :)
The interface is quite slow at the moment, because the arduino I'm using has not enough RAM (only one k) to store the whole content of the screen, so I displayed it pixel by pixel. I'm sure it can be done significantly faster when I manage my 84 MHz / 96 kB DUE to work with it.
The display is 240 x 128 pixels, so I scaled up the screen in both directions by the factor 2.

On the calculator side I made an application with a key hook which transmits the screen serially when you press a certain key (in this case ln) at any point in the OS.


Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Your 83+'s display is too small?
« Reply #1 on: April 03, 2013, 06:21:28 am »
Well, that's an impressive hack, congratulations :)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Your 83+'s display is too small?
« Reply #2 on: April 03, 2013, 06:46:52 am »
Nifty :)
In order to spread the word, I've cross-posted it at http://ti-pla.net/t11501 .

I take it that have more than 256 bytes of data in the Arduino's RAM for the purposes of your program, so indeed, storing a 768-byte screen wholesale won't do...
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Your 83+'s display is too small?
« Reply #3 on: April 03, 2013, 06:52:50 am »
Thanks :)

You would need at least 3.8 k (240/8*128) of RAM since the displaying process is the bottleneck of this system. I can transmit the data from the calc to the arduino quite quickly, but the plotting takes a lot of time. When I could use the plot functions on a screen sized buffer and shift out the whole buffer at once, it would be a lot faster.

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: Your 83+'s display is too small?
« Reply #4 on: April 03, 2013, 07:05:19 am »
Oh, but you're talking about having a buffer the size of the target screen. OK :)
The TI-68k series has a 240x128 screen area as well.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Your 83+'s display is too small?
« Reply #5 on: April 03, 2013, 07:15:51 am »
Hey, that looks pretty cool MGOS! :D

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Your 83+'s display is too small?
« Reply #6 on: April 03, 2013, 07:43:58 am »
You should post your code. I'd love to poke around for optimizations!

What arduino are you working with, anyway? From the sound of it it's an older one, with an atmega168. You can actually buy preprogrammed drop in replacements that have double the RAM.

Although, I might be able to work enough variables into the Flash program rather than RAM, so you could actually fit the screen.
« Last Edit: April 03, 2013, 07:48:26 am by willrandship »

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Your 83+'s display is too small?
« Reply #7 on: April 03, 2013, 08:03:43 am »
I'm already optimizing :)
Indeed, I'm using an just an atmega168, but it should work with the Due as well. The main problems I see is in the library I'm using. Since the atmega168 has not a single port that is accessible at once, so the lib uses to ports and bitshifts the data. On the due you could use the entire port D (or at least the lower quarter of it). Another thing is that the every pixel is written seperately, which causes a lot of unneeded communication of the LCD with the arduino (calculate the address, get the byte in the lcd memory, mask it with the new pixel, write it again). That are the two points I'm trying to optimize.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Your 83+'s display is too small?
« Reply #8 on: April 03, 2013, 08:05:20 am »
Do I not get to see code? :'(

Also, if you use the softwareserial library, you can free up port D for pin usage.
« Last Edit: April 03, 2013, 08:13:25 am by willrandship »

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Your 83+'s display is too small?
« Reply #9 on: April 03, 2013, 09:15:21 am »
Here it is, not much to it actually. I used the library found here http://arduino.cc/forum/index.php?PHPSESSID=6f0bdb4afd44e5fdfbdb5b6651cc475a&topic=22624.msg171044#msg171044

I think I'm going to rewrite the whole thing to work with the Due.

Spoiler For Arduino C++:
Code: [Select]
#include <T6963.h>
#include <T6963_Commands.h>

#define CLK 13
#define DAT 12

T6963 lcd(240,128,6);

void setup()   {
  lcd.Initialize();
  lcd.clearCG(); // Clear character generator area
  lcd.clearGraphic(); // Clear graphic area
  lcd.clearText();
  pinMode(CLK,INPUT);
  pinMode(DAT,INPUT);
}



void loop()    {
  for (byte y = 0; y < 128; y +=2){
    for (byte x = 0; x < 192; x+=2){    
        while (!digitalRead(CLK));
        int c = digitalRead(DAT);  
        lcd.setPixel(x,y,c);
        lcd.setPixel(x+1,y,c);
        lcd.setPixel(x+1,y+1,c);
        lcd.setPixel(x,y+1,c);
        while (digitalRead(CLK));
        delayMicroseconds(1);  //Needed for a stable connection, you could also use some asm("nop");
        
    }
  }
}

The axe code is really inefficient, I know. But it can be because the lcd needs that much time. I will use direct buffer access and shift out the main buffer serially in later versions. I just kept that for readability:
Spoiler For Axe code:
Code: [Select]
StoreGDB
FnOff
For(Y,0,63)
For(X,0,95)
pxlTest(X,Y)?0,1
->port
For(200):End
3->port
For(200):End
EndIf getKey(15)
EndIf getKey(15)
LnReg

Use this instead:
Spoiler For Idea:
Code: [Select]
StoreGDB
FnOff
For(I,L6,L6+767)
{I}->B
For(8)
B . 128?0,1  //bitwise and b1000000 to get the MSB
->port
For(whatever):End
3->port
B*2->B //shift left
For(whatever):End
End
EndIf getKey(15)
LnReg
« Last Edit: April 03, 2013, 09:16:37 am by MGOS »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Your 83+'s display is too small?
« Reply #10 on: April 03, 2013, 09:18:19 am »
Using direct buffer reads will at least make this 8 times faster if not 16 times :P Good job. Now try to use a color screen :)
« Last Edit: April 03, 2013, 09:19:10 am by Keoni29 »
If you like my work: why not give me an internet?








Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: Your 83+'s display is too small?
« Reply #11 on: April 03, 2013, 09:33:15 am »
Using direct buffer reads will at least make this 8 times faster if not 16 times
I know. But that's not the bottleneck at the moment. I also posted the version with direct buffer reads.

Now try to use a color screen :)
Haha :D custom upgrade to a 83+C

wait... my father gave me this a while ago (they wanted to throw it away D: ) :
Spoiler For Spoiler:
Comparison:

Look at the date :P

« Last Edit: April 03, 2013, 09:36:01 am by MGOS »

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Your 83+'s display is too small?
« Reply #12 on: April 03, 2013, 09:35:17 am »
Lucky. My father brings in semi old PC's every once in a while. Semi old is the kind of old you have to upgrade in order to sell because nobody wants it :P
If you like my work: why not give me an internet?








Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Your 83+'s display is too small?
« Reply #13 on: April 03, 2013, 09:45:22 am »
I'm working on a modification that reads and writes bytes at a time. It should also be easy to make your axe code give bytes instead as well.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: Your 83+'s display is too small?
« Reply #14 on: April 03, 2013, 09:49:43 am »
Realy impressive job, i like it! (I think i have one of those LCD's lying around too :)).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."