Author Topic: uTasker graphic LCD support and graphic library  (Read 28669 times)

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
    • View Profile
    • uTasker
uTasker graphic LCD support and graphic library
« on: July 22, 2009, 01:57:55 PM »
Hi All

The uTasker project has long supported a character LCD simulator but from version V1.4 all projects contain monochrome graphical LCD support as well as a foundation for color LCD support. This includes simulation of the LCDs in the uTasker simulator to make development more efficient and more fun.

The following lists some of the history leading up to the decision to add this support and also some basic terminology:

•   Graphical monochrome and colour LCDs have become very popular recently with processor evaluation board manufacturers typically adding such a device to their boards; sometimes connected to a dedicated interface such as the LCD controller in the LPC2478, an external memory interface such as the AVR32, via SPI such as some OLEDs on Luminary Micro evaluation boards, or more generally via GPIOs (bit-banging).

•   In addition, the semiconductor manufacturers have identified the trend and promote the use of their own devices by supplying graphic libraries as part of demonstration code (Luminary Micro, Atmel, etc.). These graphic libraries are however generally restricted to use with particular microprocessors (licensing) and are not compatible.

•   The result of these developments and research into real user requirements led to the decision to add processor-independent graphical LCD support to the µTasker project together with practical graphical LCD simulation support to accelerate project development.

•   The first step in the process is the addition of monochrome LCD support including an accurate LCD simulator which can be simply added to all processors via GPIO connections. The initial support is restricted to text and bit-maps but this is generally adequate for most real project use, whereby library functions (such as line or shape drawing) will be added as the LCD project develops.

•   In addition to the monochrome graphical LCD support as explained in this section various preparations have been made as foundation for extensions to colour support. The simulator, for example, is already capable of accurately simulating colour LCD controllers as well as processors with internal TFT LCD controller (like the LPC2478). The µTasker projects with such evaluation boards available for them also include a demonstration of this capability although it is not generally contained in the first release of the µTasker V1.4 project. See the following chapters for examples of these where applicable.

•   To fully support LCD use various conversion utilities are required. A utility for converting bitmaps as generated with standards graphics programs (paint, etc.) is already included as detailed later in this section.

•   Research and practical tests with various LCD types has shown that it is not practical to use a single low level interface. The main reason is due to the memory requirements – a monochrome graphical LCD requires about 1k of RAM in order to back-up the display memory contents, which is generally affordable and thus allows an efficient method of content manipulation and LCD updates based on changed pixels only.
A colour LCD may, on the other hand, require 230k RAM to do the same thing, which is generally not practical. There interfaces are also faster, especially when the display memory is in SDRAM used by an internal LCD controller to automatically refresh, and so there is in this case no advantage in trying to restrict accesses. These conflicting requirements led to the decision to optimise the low level interface to best suit each LCD type and so the monochrome graphical LCD interface was initially designed specifically to suit it’s inherent characteristics.

•   Monochrome graphical displays often work very similarly but may have also some special commands to perform special tasks which are restricted to certain controllers. For this reason the first version of the graphical LCD driver concentrates on building a generic foundation based on standard commands. Specific advantages offered by certain display types may be used in the future to optimise operations should this be identified as being beneficial.

•   The monochrome graphical LCD is identified from the character LCD in the µTasker project by the name GLCD (Graphical LCD). Colour graphical LCDs are further distinguished by the name CGLCD (Colour Graphical LCD).


The initial version is restricted to supporting fonts and bitmaps (including a useful utility for automatically creating all project widgets in a project file), which represents the fundamentals for the next step of developing the processor-independent uTasker graphics library. LCDs are fun to work with and you may already be quite amazed at what the first simple package can already do...! Get full details in the new LCD user's guide: http://www.utasker.com/docs/uTasker/uTaskerLCD.PDF

Have fun...

Regards

Mark

Offline lthyagar

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #1 on: September 07, 2009, 09:52:35 PM »
Hello Mark, just started playing with the uTasker, using the simulator. It is awesome.
I was successfully able to create a new task as per your instructions.
Able to to see the "hello world" on a telnet connection using PuTTY.
Next, I disabled the GLCD, and enabled the character LCD.
The telnet now outputs the "hello world" and LCD = 0xFF.
The display on the simulator is OK.

Question: Where is the LCD =0XFF coming from?

the code snippet:

#include "config.h"
extern void fnMyFirstTask(TTASKTABLE *ptrTaskTable)
{
  static unsigned char ucCounter = 0;

    fnDebugMsg("Hello, World! Test number ");
    fnDebugDec(ucCounter++, sizeof(ucCounter));
    fnDebugMsg("\r\n");
    TOGGLE_LAV_OUT() ;  // toggles portB  bit 22
}

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
    • View Profile
    • uTasker
Re: uTasker graphic LCD support and graphic library
« Reply #2 on: September 07, 2009, 10:32:12 PM »
Hi

The LCD = 0xff is coming from the test (see application_lcd.h)
    #define LCD_READ_TEST                                                // test read of LCD content

This is requesting the value of the LCD data RAM at regular intervals using the following line:

fnDoLCD_com_text(E_LCD_READ_RAM, (unsigned char *)&ucAddress, sizeof(ucAddress));

The LCD task is then reading the LCD and returning the value for display.

You can disable this by removing LCD_READ_TEST.

In fact I think that the value from the simulator is probably not correct (I known that it is good with a real LCD - at least the last time I tried it) so it may need improving...


Since this is the first post on this particular board I will take the opportunity on reporting a bit on some progress in the mean time. This is all to do with graphical LCDs (GLCD)
1. The library has been developed a bit to include support for drawing lines between two points (easy when vertical or horizontal but a but trickier when diagonal).
2. Also a rectangle function has been added.
3. Both of these can be either drawn black, white or inverted (the pixels are the opposite of the background).
4. A full character LCD font has been added (useful for making a character LCD with a graphical LCD...)
5. A blink function has been added so lines or rectangles can be given their own blink speed. Multiple such objects can be blinking at the same time (each with different blink speeds if required). The blinking is fully coordinated by the LCD task so the application doesn't need to get involved. The objects blinking can also be individually disabled.
6. The GLCD is being ported to a Samsung controller (more or less working) with compatible application interface. This means that the two most popular controllers (as far as I am aware) are then supported.
7. An OLED GLCD compatible interface has been built in. The reason for this is that many Luminary Micro boards have an OLED (usually gray scale) - although many real projects will target a GLCD it is useful to be able to test and develop also on the OLED (which is probably about the same dimension in terms of X,Y). This mode doesn't utilise gray scales - it is just black/white - but it is very handy to play with if no GLCD is wired up or available. This may also allow a number of Luminary Micro users to make first steps with the library just because it is so practical with the on-board display...
8. The next step which is foreseen is an LCD document update with the new functions and a new Luminary Micro SP to allow an easy start with these kits. It is very easy to use and also great fun to play with!

Regards

Mark


Offline Kabron

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #3 on: September 08, 2009, 12:29:32 PM »
Dear Mark
There is not CGLCD.c file in uTasker :(
Where can I find it?

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
    • View Profile
    • uTasker
Re: uTasker graphic LCD support and graphic library
« Reply #4 on: September 08, 2009, 12:52:05 PM »
Hi

CGLCD.c is only included in packages with color LCD on their development boards.
That is for
- AVR32 (the EVK1105 eval board)
- Luminary Micro (EK_LM3S3748)


TFT.c is only available in the LPC2XXX package (specifically for testing the TFT on the LPC2478 board).

The color LCD code is based on the evaluation board suppliers code but illustrates how existing code can also be simulated in the uTasker simulator (as shown by screen-shots at http://www.utasker.com/Demos/Simulations.html). The code is not yet a part of the uTasker graphical library, which is being developed initially for GLCD and then will advance to color once the ground work has been completed and the interfaces (as much compatibility as possible between different types) have been refined.

Regards

Mark


Offline Kabron

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #5 on: September 08, 2009, 01:41:03 PM »
I have LPC2478STK from Olimex. When I try to compile uVision3_LPC23xx example I got error concerning CGLCD.C absence.
IAR example was compiled allmost OK last week, except GLCD which do not work on hardware and in simulator and strange garbadge:

?r? 8??G8µiF???(?? !A^ ??a? 8??G8µiF???(??!A^ ??P? 8??G0µ‹° ©?¦?(?di 4 ?????  °? ??G?j"’’’’ ?R)???? M!?"

 on the WEB page.

Today trying to compile last week project I got error message from IAR:

X ielftool error: Symbol not found __vector
X Error while running Linker


Offline Kabron

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #6 on: September 08, 2009, 01:51:12 PM »
The only changes I did:
in application.c only network settings.
in config.h
    //  #define LPC2378FBD144                                             
    #define LPC2478FBD208                                             

      #define OLIMEX_LPC2378_STK                                       
      //  #define KEIL_MCB2300                                           

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
    • View Profile
    • uTasker
Re: uTasker graphic LCD support and graphic library
« Reply #7 on: September 08, 2009, 02:10:12 PM »
Hi

The CGLCD.c in the uVision project is a mistake - it can be deleted from the project (I probably tested with it still in the directory so didn't notice it).

When working with the LPC2478 and Olimex (your settings are correct) it will automatically activate the TFT test. This means that it is not possible to enable any other LCDs (like GLCD) without first deactivating SUPPORT_TFT. If the original V1.4 config.h is used, LPC2478FBD208 enabled and SUPPORT_GLCD disabled it should then default to the Olimex board with TFT.

Regards

Mark

Offline Kabron

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #8 on: September 08, 2009, 03:06:54 PM »
OK. Report continued.
I forced      //#define SUPPORT_GLCD
allthough
 #if defined SUPPORT_GLCD && !defined SUPPORT_TFT
did the same.

TFT not working. Not in HW nor in simulator.

I could make WEB interface to work correctly by manual downloading all files via TotalCommander FTP client. If use bat file everything seems OK, but only 3 files were downloaded.


Offline Kabron

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #9 on: September 08, 2009, 03:13:24 PM »
I put breakpoint to fnDisplayBitmap in Simulator. it never reached when I tried to sent image from the WEB.

Offline RogerH

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #10 on: September 23, 2009, 11:07:21 AM »
Hi Mark,

In your post to this thread on 9 September you talk of further developments for Graphics LCDs.

Will this library work with TFT devices such as Olimex LPC2478-STK board, I will be over the moon if it does?

Thanks, Roger...

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
    • View Profile
    • uTasker
Re: uTasker graphic LCD support and graphic library
« Reply #11 on: September 23, 2009, 12:12:50 PM »
Hi Roger

Presently the development concentrates on monochrome LCDs, which have been the most popular to date.

As mentioned previously there are more functions available (lines, squares, blinking objects etc.) and this has also been extended to Samsung type controllers (that is, both Toshiba and Samsung based displays are compatible, even though the internal pixel/byte layouts are not). Where I am rather behind is in generating a new library package so that this is then actually generally available - it involves some more clean-up work and a document update, but a Samsung based commercial project has already been successfully implemented as test vehicle.

The design is based on a backup of the image in a pixel buffer the same size as the display. Pixel manipulation is performed there and writes to the display are only made when expressly commanded, and where a change is really detected.

In the case of the TFT there are several differences which make in not 100% compatible:
- first of all it doesn't have a single bit for a pixel but up to 4 bytes (depending on controller mode - eg. 24bit color). The present library is monochrome and so doesn't support the color part at the moment.
- the TFT (based on refresh directly from RAM as on the LPC2478) is in fact easier in that writing to the buffer already changes the image displayed. This means that the buffer method is similar (apart from the pixel size) but without the display write function being needed.

Also here I think that an intermediate step with monochrome content and compatible user interface would be a useful step, even when using a rather limited amount of the TFTs color capability. This is analogue to the OLED as described previously (although it supports gray scales, it is compatible in monochrome mode).

Finally note that routines supplied by other sources can be used and also will work in the simulator, which accelerates developments. Check the code supplied with the Olimex board.

In the meantime I will try to get a new library released - possible with the TFT monochrome mode, which may be interesting for some work and tests and will certainly be a useful stepping stone on the way to more color functionality too.

Regards

Mark


Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3060
    • View Profile
    • uTasker
Re: uTasker graphic LCD support and graphic library
« Reply #12 on: September 27, 2009, 09:41:35 PM »
Hi Roger

Quick update: I have reworked the project to put the complete GLCD (monochrome) interface into the uGLCDLIB, supporting both Toshiba and Samsung based controllers and with emulation modes for OLED [on Luminary boards] and TFT [on LPC24XX]. This means that GLCD monochrome projects can be tested on OLED or TFT. This works successfully in the simulator and on the evaluation boards so a uGLCDLIB V1.1 is very close.

To round of this first session I also added scrolling support to the interface meaning that it is quite easy to use the displays for debug text output (as well as the other features discussed previously). A scroll is commanded and a line of text written to the coordinate of the start of the bottom text line in the display, causing the complete screen contents to be moved up one line (or as many pixels as specified) and the new text line written in the new blank space.

I may add the same for some other color based LCDs (AVR32 board and Luminary with SPI based TFT) to complete the packet. Then I will need to update the uGLCDLIB document and either release some complete project updates of just uGLCDLIB packet updates (to be decided).

Regards

Mark


Offline RogerH

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #13 on: September 28, 2009, 12:46:57 AM »
Hi Mark,

Sounds fantastic, I look forward to trying the new uGLCDLIB.

Cheers, Roger...

Offline mrutyunjay

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: uTasker graphic LCD support and graphic library
« Reply #14 on: October 01, 2009, 01:49:16 PM »
hi,
congratulation for the best tool you have created,
after a long gap I am back on utasker ,
initial i just tested the simulator part in ver 1.3
good to see ver 1.4 beta release
so today did some hand-on testing with  lm6965  kit ! worked great except oled !

was pulling my hairs why it not working , then i saw glcd and oled defines !

wanted to check out test oled lcd  simulation ,
commented following in config.h
#define SUPPORT_GLCD
uncommented
#define SUPPORT_OLED

got error
"uTasker_root\Applications\uTaskerV1.4\OLED.c(27) : fatal error C1083: Cannot open include file: 'GLCD_Core.h': No such file or directory"

searched for it in 1.4 folder doesn't exist

I think it not yet supported !

looked around in LCD user guide chapter 4
didn't find any pointer to oled usage   

In this post i read some thing of emulation of glcd on olcd

my mistake I had assumed glcd would support oled , then i read this post!

Is their any upcoming support for oled display on LM  kits?

In the mean time i will try to find some char lcd  16x2 from old project
and wire then to LM kit   


Thanks and regards
mrutyunjay
(LM3s6965 Eval board + cs-lite +eclipse+oocd )