Code for graphic LCD with minimum RAM

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I bought recently AVR dev. board with AT90CAN128 and LCD Touchscreen 160x160 dots. I am playing around with the demo software, which is writing some text on the screen.

The problem is that it is using almost all RAM (>90%), so there is not much spare space to build a custom application, and especially not if I want to implement FatFs on the MMC. I can see that the demo is writing first all the texts in a 3kB bitmap with 160x160 dots, which is afterwards sent to the graphic LCD in a stream with 4-bits, and clocking CP, LP and FLM. This bitmap is built by mapping the string characters with the fonts stored in the progmem.

Is there any alternative to reduce the size of the RAM?

I tried to reduce the bitmap 20x times to represent just a single line of text, which I update with new text after the previous line is written. However, this doesn't work well since interrupting the display clocking while updating the small bitmap creates horizontal lines on the bottom of each row.

I reconsidered storing the texts i.e. the menus in the Flash memory, but some screens should have dynamic texts (file directories), so it is difficult to avoid using the RAM.

Any good ideas?

Regards,
P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get a mega1280 with 8k of ram?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you're going to beat your head against a wall for not much reason here. Go with a processor with more RAM, or add external RAM. You could even consider a 2-processor solution with one running your main application and the other tending to the display.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know the details of your hardware, but your LCD controller may already have the RAM used to drive the display and your current software may be constructing a duplicate copy of the display memory in the microcontroller. If this is the case, you should be able to rewrite the LCD software so that it does not have a duplicate copy of the display memory in the microcontroller.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You do not quote a part number for your graphic screen.

Many have their own RAM, so you do not have to use the AVR SRAM. And if you are always writing fresh info to your display, you do not care what the contents are. For example, writing text normally needs to obliterate the previous contents.

It is only when you want to plot a pixel at (X, Y) that you need to know what is in the other seven adjacent bits. So that you write back the correct 8 bits.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since the dev. board generates the CP, LP and FLM signals (aka dotclock, hsync, vsync), we can safely assume this is a "raw" LCD, one without any internal memory.
To provide full graphics support, an internal bitmap of 3.2KB needs to be maintained (160 x 160) /8, which is a very large part of the internal SRAM of the AT90CAN128 (4K).
However, when displaying just text, it is possible to maintain ONLY the text image in memory, generating the proper pixels on the fly. A project already submitted does exactly this: "Graphical LCD text Video Display"

https://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=1807

jrseattle

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for all the replies.

The LCD is from a Palm PDA (PC0919WE07) and is what you call for "raw" LCD, reminding me very much of a CRT :)

The original idea was that I use this dev. board as it is in the final application, since it has all the features that I desire - LCD with touchscreen capability and MMC. It is just pitty that I have a problem finding space in the RAM for my application.

I am now tempted in using the ATMega 1281 since the TQFP64 packages seem to be pin compatible. Some of the functionality could be missing like CAN, but I am not using it. Anybody tried switching from the one to the other device in the past, with success?

I am going to check the proposed approach with holding the text image instead of the bitmap. However, I am a bit afraid that I tried it sort of yesterday, when I moved the font mapping from the progmem into the display update routine based on the incoming text. I was not satisfied with the result - I could hardly recognize the text and everything was kind of grey. I guess that the font mapping process by looking up in the progmem takes some time and this creates black lines all over the display. For contrast, with the original code I get just a single black line at the bottom of the screen, probably on the last line where the clocking stops i.e. the display update is finished.

Regards,
P.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello
I need information about Touchscreen LCD PC0919WE07. I'm a student and I have project but I can't find info in Internet :( . If someone has datasheet or some other info about it please give it. Microcontroller is AT90CAN128.
Thanks

Nasko

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What kind of information do you need? Probably it is 4 or 5 wire resistive touch screen, you can easy find examples how to use it, even without dedicated controller, only ATMega/Tiny ADC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's my first project and I need description ot each pin and what it is use for. Some ot the pins are D0-D3, FLM, LP, CP, DISP,XL,XR,YU,YL. I found the names of the pins and that FLM is First line maker, LP is Lathc pulse, CP is Clock pulse but I don't know what are for. There are such XL XR,YU,YL (maybe Right, Left, Up and Low?). Please help me
Thanks

Nasko

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

It's my first project

Quote:

Please help me

You have picked just about the most complex thing you can do on an AVR for your very first project.

Those signal names show this is not an "intelligent" panel with it's own display RAM and timing controller. Instead it's a raw panel and you have to generate all the timing control signals yourself and find room inside the AVR's own RAM (or external) to maintain a framebuffer.

You may want to look at getting a mobile phone display or something with a controller like a KS0107/KS0108 or T6963 on it that takes almost all the work off the hands of the AVR. Otherwise you may not have much time left on the AVR do do anything more than the display scanning duties.

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems like ratep2001 thread and nassko thread should be 2 different threads?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Nasko,

I agree with Bob that your questions are suitable for a completely new thread.

Anyway, I can see out of your hardware that there are similarities with mine, so maybe you would like to visit the website of Olimex ltd. and check the test code for their development board AVR-TLCD-128CAN. Check especially the lcd_update routine in main.c, it will answer most of your questions regarding clocking and data transfer for the LCD. XL,XR,YU and YL are outputs from the touchscreen, these are brought probably to your ADC.

If you get into trouble, drop me an email at ratep2001@yahoo.com

Regards,
Petar